Checking Disk Usage on Linux: du, df, and ncdu

“Where did my disk space go” is one of the most common Linux troubleshooting questions, and three tools cover it well — each suited to a slightly different part of the investigation.

# df: overall filesystem usage, per mounted volume
df -h

# du: usage of a specific directory tree
du -sh /var/log          # total size of one directory
du -h --max-depth=1 /var | sort -rh   # per-subdirectory breakdown, sorted

# ncdu: interactive, navigable disk usage explorer
sudo apt install ncdu
ncdu /var

Why ncdu Is Worth Installing

du gives you numbers; ncdu gives you an interactive, browsable tree you can drill into with arrow keys, deleting files directly from within it if needed — genuinely faster than repeatedly running du with different paths when you’re actually hunting for what’s eating space.

A common gotcha: df can show a filesystem as full even after deleting files, if a process still has the deleted file open — lsof | grep deleted finds these phantom space consumers, which only get reclaimed once the holding process exits or is restarted.