Sample output
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 234G 187G 35G 85% /
tmpfs 7.8G 1.2M 7.8G 1% /dev/shm
/dev/sdb1 932G 548G 337G 62% /data
The root filesystem is at 85% capacity with 35 G remaining. The /data mount has more room. If the root partition is the one filling up, the next step is du -h -d1 / to find out what is consuming it.
When you would reach for it
A deploy fails because there is no space left to write temporary files. A database stops accepting writes. A monitoring alert fires at 90% and you need to see every mount point at once, not guess which one crossed the threshold. df is the first command in any disk triage because it answers the question in under a second.
Gotchas
- The “Avail” column is often less than “Size” minus “Used” because ext4 reserves 5% of the filesystem for root by default. The space exists but is not available to regular users. Tune it with
tune2fs -mif you need it back. - On macOS the output includes inode columns (
iused,ifree,%iused) that Linux omits by default. The numbers are the same, the table is wider. - Virtual filesystems like
tmpfs,devtmpfs, and snap mounts clutter the output. Pipe throughgrep -v tmpfsor usedf -h -x tmpfs -x devtmpfson Linux to filter them out. The-xflag is GNU-specific and does not exist on macOS.
Variants
$ df -h /var/log
Show usage for one mount point. Pass any path and df reports the filesystem that contains it
$ df -ih
Show inode usage instead of block usage. A filesystem can have plenty of space but run out of inodes if it holds millions of tiny files, and the error message is the same: “No space left on device”
$ df -h | awk 'NR>1 && +$5 > 80'
Find filesystems over 80% full. awk skips the header, coerces the Use% column to a number, and prints only the rows that exceed the threshold