Find which subdirectories use the most disk space with du
Measure the size of each immediate subdirectory and sort them smallest to largest so the biggest offenders land at the bottom.
01Command
$ du -h --max-depth=1 . | sort -h02What it does
du walks the tree and sums file sizes; --max-depth=1 reports each child directory as one total instead of every nested path. sort -h understands the K/M/G suffixes du prints, so sizes order correctly. Start at /var, /home, or / and drill down by repeating the command inside the largest directory. Add sudo to count files you cannot read, use -x to stay on one filesystem (skip /proc and other mounts), and note du counts allocated blocks, so sparse files can appear larger than they are.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- du(1) — estimate file space usageEvidence: The du man page documents '--max-depth=N' to limit the depth of directory reporting and '-h' for human-readable sizes.
Last verified: 2026-09-17 · Category: Files & Folders
06Related solutions
Show total, used, and available space plus usage percentage for every mounted filesystem in human-readable units.
Display every block device as a tree — disks, partitions, sizes, filesystems, UUIDs, and where each is mounted.
Find every occurrence of a pattern across all files in a tree, printed as file:line:number matches.