Skip to content
# Storage & disks

Disk usage: df, du and ncdu

Check free space per filesystem and find what's actually eating your disk.

Free space per filesystem: df

df shows how much space is used and free on each mounted filesystem. -h prints sizes in human-readable units (G, M) instead of raw blocks.

bash
df -h

Find what's using the space: du

du reports the size of directories and files. Run it on a directory with -s for a summary and -h for human-readable sizes; sort the output to find the biggest offenders first.

bash
du -sh /var/log
du -h --max-depth=1 /var | sort -rh | head -n 10

Browse interactively: ncdu

ncdu (NCurses Disk Usage) scans a directory once and gives you a navigable, sorted view β€” much faster than repeated du calls when you're hunting for what to delete.

bash
sudo apt install ncdu   # or dnf/zypper/apk/pacman
ncdu /var

Common cause: a filling disk isn't always visible files

If df shows a disk full but du can't account for the space, check for deleted-but-still-open files held by a running process (common with log files a service still has a file handle on) with lsof +L1, or check inode exhaustion with df -i.

bash
df -i
sudo lsof +L1