Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Linux du command

Linux du command

Linux Command Reference Linux Command Reference

The Linux du (short for disk usage) command is used to display the size of directories or files.

du displays the disk space occupied by the specified directory or file.

Syntax



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

Parameter Description:

Example

Display the space occupied by a directory or file:



# 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 sizes of subdirectories under the current directory and the total size of the current directory; the 1288 at the bottom is the total size of the current directory

Display the space occupied by a specified file



# du log2012.log 

300     log2012.log

Display the space occupied by the test directory in an easy-to-read 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 Reference Linux Command Reference