Every day a Linux command (--DU) command

Source: Internet
Author: User

The Linux du command also looks at the space used, but unlike the DF command, the Linux du command is a view of the space used by the file and directory disks, or some difference from the DF command.

1. Command format:

du [Options] [file]

2. Command function:

Displays the disk usage space for each file and directory.

3. Command parameters:

-A or-all lists all files in the directory and displays the size of each file

-B or-bytes when displaying a directory or file size, in bytes

-C or--total displays the sum of all directories or files in addition to the size of individual directories or files

-K or--kilibytes

-M or--megabytes

-S or--summarize only show totals, only the last plus total value is listed

-H or--human-readable in K,m,g, automatically adjusts to the most appropriate display unit, improving the readability of the information

-X or--one-file-system is subject to the file system at the beginning of processing, and if a different file system directory is encountered, skip

-l< the source file size of the symbolic link specified in the Symbolic link > or--dereference< symbolic link > Display option

-S or--separate-dirs displays the size of individual directories without the size of their subdirectories

-x< file > or--exclude-from=< file > in < file > specify directory or File

--exclude=< directory or File > skip the specified directory or file

-D or--dereference-args displays the source file size for the specified symbolic link

-H or--si is the same as the-h parameter, but the k,m,g is converted to 1000 units

-L or--count-links duplicate hardware linked files

4. Usage examples:

Example 1: Display the directory or the space occupied by the file

Command:

Du displays only the directory size of subdirectories below the current directory and the total size of the current directory

Example 2: Display the space occupied by the specified file

Command:

Du 001.log

Example 3: View the occupied space for a specified directory

Du file

Example 4: Show the space occupied by multiple files

Command:

Du 001.tar.gz 002.tar.gz

Example 5: Show only the sum size

Command:

Du-s

Example 6: Easy-to-read format display

Command:

Du-h Test example can also be written as: Du-s-H

Example 7: Show how many files or directories each occupy the size of disk space, and also count their sums

Command:

Du-c 001.tar.gz 002.tar.gz

Example 8: Sort by Space size

Command:

Du | Sort-nr | More two Pipeline 3 commands, I like to see this combination of commands, so that people in learning when unconsciously can learn more skills.

Example 9: Output the space used by each subdirectory under the current directory

Command:

Du-h--max-depth=1

  

  

Every day a Linux command (--DU) command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.