Forever & AlwaysLINUX COMMAND ATLAS

LINUX COMMAND ATLAS · COMMAND GUIDE

Linux du command

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

GNU Coreutils

Syntax

Command form
du [OPTION]... [FILE]...

Common options

6 options
OptionWhat it does
-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.

Usage examples

3 examples

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

du -sh ./*

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

Notes

Directory totals can include filesystem allocation and may differ from apparent file sizes. Large recursive scans can take time.