du

v0.0.28
du [OPTION]... [FILE]...
du [OPTION]... --files0-from=F

Estimate file space usage

Options

--help

Print help information.

--all, -a

write counts for all files, not just directories

--apparent-size

print apparent sizes, rather than disk usage although the apparent size is usually smaller, it may be larger due to holes in ('sparse') files, internal fragmentation, indirect blocks, and the like

--block-size=<SIZE>, -B <SIZE>

scale sizes by SIZE before printing them. E.g., '-BM' prints sizes in units of 1,048,576 bytes. See SIZE format below.

--bytes, -b

equivalent to '--apparent-size --block-size=1'

--total, -c

produce a grand total

--max-depth=<N>, -d <N>

print the total for a directory (or file, with --all) only if it is N or fewer levels below the command line argument; --max-depth=0 is the same as --summarize

--human-readable, -h

print sizes in human readable format (e.g., 1K 234M 2G)

--inodes

list inode usage information instead of block usage like --block-size=1K

-k

like --block-size=1K

--count-links, -l

count sizes many times if hard linked

--dereference, -L

follow all symbolic links

--dereference-args, -D, -H

follow only symlinks that are listed on the command line

--no-dereference, -P

don't follow any symbolic links (this is the default)

-m

like --block-size=1M

--null, -0

end each output line with 0 byte rather than newline

--separate-dirs, -S

do not include size of subdirectories

--summarize, -s

display only a total for each argument

--si

like -h, but use powers of 1000 not 1024

--one-file-system, -x

skip directories on different file systems

--threshold=<SIZE>, -t <SIZE>

exclude entries smaller than SIZE if positive, or entries greater than SIZE if negative

--verbose, -v

verbose mode (option not present in GNU/Coreutils)

--exclude=<PATTERN>

exclude files that match PATTERN

--exclude-from=<FILE>, -X <FILE>

exclude files that match any pattern in FILE

--files0-from=<FILE>

summarize device usage of the NUL-terminated file names specified in file F; if F is -, then read names from standard input

--time=<WORD>

show time of the last modification of any file in the directory, or any of its subdirectories. If WORD is given, show time as WORD instead of modification time: atime, access, use, ctime, status, birth or creation

--time-style=<STYLE>

show times using style STYLE: full-iso, long-iso, iso, +FORMAT FORMAT is interpreted like 'date'

Display values are in units of the first available SIZE from --block-size, and the DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables. Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).

SIZE is an integer and optional unit (example: 10M is 1010241024). Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB,... (powers of 1000).

PATTERN allows some advanced exclusions. For example, the following syntaxes are supported: ? will match only one character * will match zero or more characters {a,b} will match a or b

Examples

List the sizes of a directory and any subdirectories, in the given unit (B/KiB/MiB):

du -{{b|k|m}} {{path/to/directory}}

List the sizes of a directory and any subdirectories, in human-readable form (i.e. auto-selecting the appropriate unit for each size):

du -h {{path/to/directory}}

Show the size of a single directory, in human-readable units:

du -sh {{path/to/directory}}

List the human-readable sizes of a directory and of all the files and directories within it:

du -ah {{path/to/directory}}

List the human-readable sizes of a directory and any subdirectories, up to N levels deep:

du -h --max-depth=N {{path/to/directory}}

List the human-readable size of all .jpg files in subdirectories of the current directory, and show a cumulative total at the end:

du -ch {{*/*.jpg}}

List all files and directories (including hidden ones) above a certain [t]hreshold size (useful for investigating what is actually taking up the space):

du --all --human-readable --threshold {{1G|1024M|1048576K}} .[^.]* *

The examples are provided by the tldr-pages project under the CC BY 4.0 License.

Please note that, as uutils is a work in progress, some examples might fail.