Linux du command
Linux Command大全
Linux du command (full name in English: disk usage) is used to display the size of directories or files.
du will display the disk space occupied by the specified directory or file.
Syntax
du [-abcDhHklmsSx][-L <symbolic link>][-X <file>][--block-size][--exclude=<directory or file>][--max-depth=<directory level>][--help][--version][directory or file]
Parameter Description:
- -a or-all Displays the size of individual files in the directory.
- -b or-bytes When displaying the size of directories or files, it is displayed in bytes.
- -c or--total In addition to displaying the size of individual directories or files, it also displays the total size of all directories or files.
- -D or--dereference-args Displays the size of the source file specified by the symbolic link.
- -h or--human-readable Increase the readability of information with K, M, G units.
- -H or--si With-h parameters are the same, but K, M, G are1000 as the conversion unit.
- -k or--kilobytes With1024 bytes as the unit.
- -l or--count-links Recalculates the size of files linked by hardware.
- -L<symbolic link> or--Dereference<symbolic link> Displays the size of the source file specified in the options.
- -m or--megabytes With1MB as unit.
- -s or--summarize Only display the total.
- -S or--separate-dirs When displaying the size of individual directories, do not include the size of their subdirectories.
- -x or--one-file-xystem Take the file system at the beginning of processing as the standard, and ignore other different file system directories if encountered.
- -X<file> or--exclude-from=<file> In the specified directory or file <file>.
- --exclude=<directory or file> Skip the specified directory or file.
- --max-depth=<directory levels> Ignore directories beyond the specified level.
- --help Display help.
- --version Display version information.
Online Examples
Display the space occupied by directories or files:
# du
608 ./test6
308 ./test4
4 ./scf/lib
4 ./scf/service/deploy/product
4 ./scf/service/deploy/info
12 ./scf/service/deploy
16 ./scf/service
4 ./scf/doc
4 ./scf/bin
32 ./scf
8 ./test3
1288 .
Only display the directory size of the subdirectories under the current directory and the total size of the current directory, the bottom-most1288For the total size of the current directory
Display the space occupied by the specified file
# du log2012.log
300 log2012.log
Display the space occupied by the test directory in a convenient format:
# du -h test
608K test/test6
308K test/test4
4.0K test/scf/lib
4.0K test/scf/service/deploy/product
4.0K test/scf/service/deploy/info
12K test/scf/service/deploy
16K test/scf/service
4.0K test/scf/doc
4.0K test/scf/bin
32K test/scf
8.0K test/test3
1.3M test
Linux Command大全