System administration

Linux du command

Estimate directory space use. Here, list direct children in readable units.

Availability: Common Linux commands; shell built-ins and external implementations may differ by distribution.中文

Syntax

du [OPTION]... [FILE]...

Examples

Show the total size of ./build.

du -sh ./build

List the ten largest entries by human-readable size.

du -ah . | sort -h | tail -n 10

Parameters, options and clauses

Option / clauseDescription
-h, --human-readablePrint sizes in readable units.
-s, --summarizeDisplay only a total for each argument.
-a, --allInclude files as well as directories.
-d N, --max-depth=NLimit output to N directory levels.
-x, --one-file-systemSkip directories on other filesystems.
-c, --totalAdd a grand total.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory