Commands · Command

CommandLinuxmacOS

du

du [options] [path]

Reports how much disk space specific files and directories are actually using, recursively by default.

// FLAGS

-hhuman-readable sizes
-ssummarize — total for the given path only, not every subdirectory
-ainclude individual files, not just directories

// EXAMPLE

du -sh /var/log — prints a single human-readable total for how much space /var/log is using.

// GOTCHA

Without -s, du prints a line for every subdirectory it recurses into — an overwhelming wall of output on a deep tree — almost always pair it with -s for a top-level answer.

// RELATED COMMANDS