Check Disk Space with df and du

When a disk fills up, programs stop working properly. df shows how much space is free on each disk, and du shows which folders are using it.

Free space on each disk

df -h
Shows the size, used space and free space of each disk, in easy to read units (G, M).
df -h /home
Shows just the disk that holds /home.

What is using the space

du -sh documents/
Shows the total size of the documents folder.
du -h --max-depth=1 . | sort -h
Shows the size of each folder in the current directory, smallest to largest.
du -sh * | sort -h | tail
Shows the 10 biggest files and folders in the current directory.
sudo du -xh --max-depth=1 / 2>/dev/null | sort -h
Shows which top-level folders use the most space on the main disk. -x stays on one disk.

Finding big files

find . -type f -size +100M
Lists files bigger than 100 MB. See the find guide for more.

Tip: ncdu is an interactive tool for exploring disk use. Install it with sudo apt install ncdu, then run ncdu.

Quick reference

OptionMeaning
df -hFree space on each disk
du -sh folderTotal size of a folder
du -h --max-depth=1Size of each folder, one level down
sort -hSort sizes like 1K, 2M, 3G
-xStay on one disk