Find the Biggest Files With du and sort

Rank files and folders by size using a human-readable sort.

LinuxFilesstatsdiskLow risk
Run du -ah . | sort -rh | head -20 to list the twenty largest entries.

01Command

Command
$ du -ah . | sort -rh | head -20

02What it does

du prints sizes for every file and directory, sort -h orders human-readable units correctly and head trims the list, giving an instant space audit. This composable pipeline is a textbook reason to use the shell for filesystem analysis.

03Risk

RiskLow risk
RequirementsPreinstalled on Linux (GNU coreutils)
!Warning: Traversing huge trees can take time and cross mount points; add -x to stay on one filesystem.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

Last verified: 2026-10-13 · Category: Files & Folders

06Related solutions