Original: http://blog.csdn.net/ouyang_peng/article/details/10414499
du [-ABCDHHKLMSSX] [L < Symbolic connection >][-x < file >][--block-size][--exclude=< directory or file] [--max-depth=< number of directory layers >][--help][--version][directory or file] Common parameters:-A or-all to display disk usage for each specified file, or to display the respective disk usage for each file in the directory. -B or-bytes displays the directory or file size in bytes. -C or –total displays the sum of all directories or files in addition to the size of the directory or file. -D or –dereference-args displays the source file size for the specified symbolic connection. -H or –human-readable to k,m,g to improve the readability of the information. The-H or –si is the same as the-h parameter, but the k,m,g is in 1000 as the conversion unit instead of 1024. -K or –kilobytes in 1024 bytes. -L or –count-links a file that calculates hardware connections repeatedly. The source file size for the symbol connection specified in the-l< symbol connection > or –dereference< symbol connection > Display option. -M or –megabytes is in 1MB. -S or –summarize displays only totals, that is, the current directory size. When-S or –separate-dirs displays the size of each directory, it does not contain the size of its subdirectories. -X or –one-file-xystem the file system at the start of the process, and if you encounter a different file system directory, skip. -x< files > or –exclude-from=< files > specify directories or files in < file >. –exclude=< directory or File > skips the specified directory or file. –max-depth=< the directory layer > beyond the specified number of layers, ignored. –help display Help. –version Displays version information.
1> to display disk usage for a directory tree and each subtreeDu/home/linux This displays the number of disk blocks in the/home/linux directory and each of its subdirectories.
2> to display the disk usage of a tree and each subtree in 1024-byte unitsDu-k/home/linux
This shows the number of 1024-byte disk blocks in the/home/linux directory and each of its subdirectories.
3> Displays the disk usage of a directory tree and each subtree in MBDu-m/home/linux This displays the number of MB disk blocks in the/home/linux directory and each of its subdirectories.
4> Displays the disk usage of a directory tree and each subtree in GBDu-g/home/linux This displays the number of GB disk blocks in the/home/linux directory and each of its subdirectories.
5> View the size of all directories and subdirectories under the current directory:Du-h. "." Represents the current directory. can also be replaced with a clear path-H to show the human form of K, M, G
6> View the size of the user directory under the current directory and do not want to look at other directories and their subdirectories:Du-sh user-s The meaning of the summary, which lists only one summarized value du-h--max-depth=0 user--max-depth=n represents depth to the N-tier directory, which is set to 0, which means that it is not drill-down to subdirectories.
7> Lists the size of all directories and files under the user directory and its subdirectories:Du-ah user-a representation includes directories and files
8> lists the size of directories in the current directory that do not include the XYZ string:Du-h--exclude= ' *xyz* '
9> want to show more information about the user directory and subdirectory size in one screen:du-0h User
-0 (Bar 0) represents the information for each directory that is listed, without wrapping, but directly outputting the information for the next directory.
10> Displays all disk usage for only one directory treeDu-s/home/linux
11> View each folder size: Du-h--max-depth=1