Modular Computers the manual GitHub

du

du: estimate file space usage.

Synopsis

du [-asbhc] [-d n] [path…]

Description

du prints how much each directory under each path holds, everything inside it counted, deepest first and the path itself last. Each line is a size, a tab, and the path. With no path, it uses ..

Sizes are in 1 KiB blocks: each file takes its size rounded up to whole blocks. Symbolic links are counted as themselves and never followed (as GNU du’s -P). A file given as a path is always printed.

Options

-a
Print each file too, not only directories.
-s
Print only a total for each path given (the same as -d 0).
-h
Print sizes in human-readable form, in powers of 1024 (for example 1.5K, 2M).
-b
Print sizes in bytes, the files’ real sizes, not rounded to blocks. It takes precedence over -h.
-c
Print a grand total of all the paths at the end, labeled total.
-d n, –max-depth n
Print directories (and with -a, files) only down to n levels below each path; everything deeper is still counted.

Single-letter options may be combined, as in -sh.

Exit status

0 on success; 1 if a path could not be read or an option was invalid.

Examples

du -sh /home
du -ad 1 /lib
du -sc /bin /lib

Notes

The –max-depth=n form is not supported; give the number as the next argument.

See also

df(1), ls(1), find(1), tree(1)