Easy Tutorial
❮ Linux Comm Swapoff Linux Comm Mpartition ❯

Linux du Command

Linux Command Manual

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

du shows the disk space used by the specified directory or file.

Syntax

du [-abcDhHklmsSx][-L &lt;symbolic link>][-X <file>][--block-size][--exclude=&lt;directory or file>][--max-depth=&lt;directory levels>][--help][--version][directory or file]

Parameter Description:

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 show the sizes of subdirectories under the current directory and the total size of the current directory, where 1288 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 usage of the test directory in a human-readable 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 Manual

❮ Linux Comm Swapoff Linux Comm Mpartition ❯