Locate Largest Files Top 10
Luke Hebert
- One minute read - 191 wordsDisk space fills up faster than you expect, and the first question is always the same: what is taking all that room? The command below walks a directory tree, sorts by size, and hands you the top ten offenders in one shot.
The Command
du -a /var | sort -n -r | head -n 10What Each Piece Does
du -a /var- reports disk usage for every file and directory under/var.sort -n -r- sorts the output numerically in reverse order, so the largest entries come first.head -n 10- keeps only the first ten lines.
Tips
- Swap
/varfor any path you want to inspect, such as/home,/opt, or/. - Add
--excludetoduif you want to skip known large directories like/var/lib/docker. - Pipe through
awk '{print $1, $2}'if you want a cleaner two-column output.
Note
du reports sizes in 1024-byte blocks by default. Add the -h flag to get human-readable units (K, M, G) if you prefer.
This is a go-to when a server starts throwing “No space left on device” errors and you need a fast answer before digging deeper.