Latest web development tutorials

Linux du command

Linux command Daquan Linux command Daquan

Directory, or file size Linux du command displays.

du displays the specified directory or file occupied disk space.

grammar

du [-abcDhHklmsSx][-L <符号连接>][-X <文件>][--block-size][--exclude=<目录或文件>][--max-depth=<目录层数>][--help][--version][目录或文件]

Parameter Description:

  • -a or -all show directory size of individual files.
  • When -b or -bytes directory or file size in byte units.
  • -c or --total addition to displaying individual directories or file size, but also shows the sum of all the directory or file.
  • -D Or --dereference-args Displays the symbolic link source file size.
  • -h or --human-readable with K, M, G as a unit, to improve the readability of the information.
  • -H Or -h --si with the same parameters, but K, M, G 1000 is based on the conversion units.
  • -k or --kilobytes to 1024 bytes as a unit.
  • -l --count-links or file double counting hardware connections.
  • -L <Symbolic link> or --dereference <symbolic link> Display Options in the symbolic link source file size specified.
  • -m or --megabytes to 1MB units.
  • -s or --summarize display only totals.
  • -S Or --separate-dirs when the display size of individual directories and does not contain the size of its subdirectories.
  • -x or --one-file-xystem to start processing a file system prevail, when there are other different file system directory is skipped.
  • -X <File> or --exclude-from = <file> in <file> specified directory or file.
  • --exclude = <file or directory> skip specified directory or file.
  • --max-depth = <directory levels> after exceeding the specified number of directory ignored.
  • --help displays help.
  • --version display version information.

Examples

Display directory or file uses less space:

# 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    .

Show only the total size of the total size of the current directory and subdirectories of the current directory size directory, the bottom of the current directory 1288

Displays the specified file space occupied

# du log2012.log 
300     log2012.log

Easy to read format test directory footprint situation:

# 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 Daquan Linux command Daquan