This post was originally published on go2linux.org on May 18, 2007. The domain is no longer mine, but I am the original author. I am republishing it here on garron.me with corrections and improvements.

When you need to know how much space is used on your disks and how much is free, df (Disk Free) is the command you want. It shows you all mounted filesystems at a glance.

Basic usage

df [options] [filesystem]

With no arguments, df lists all mounted filesystems:

$ df
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/sda1      151225248  16280980 127262392  12% /
tmpfs             517924         0    517924   0% /dev/shm
/dev/sdb1      76896316   54820876  18169240  76% /media/data

The numbers are in 1K blocks by default, which is not easy to read. Use -h for human-readable output:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       145G   16G  122G  12% /
tmpfs           506M     0  506M   0% /dev/shm
/dev/sdb1        74G   53G   18G  76% /media/data

Useful options

Show filesystem type (-T):

$ df -hT
Filesystem     Type   Size  Used Avail Use% Mounted on
/dev/sda1      ext4   145G   16G  122G  12% /
tmpfs          tmpfs  506M     0  506M   0% /dev/shm
/dev/sdb1      ext4    74G   53G   18G  76% /media/data

Useful when you have a mix of ext4, xfs, tmpfs, and network mounts and want to know what you are dealing with.

Show only local filesystems (-l):

$ df -hl

This excludes network mounts (NFS, sshfs, etc.), which is handy on servers with many remote mounts.

Check inode usage (-i):

$ df -i
Filesystem      Inodes  IUsed   IFree IUse% Mounted on
/dev/sda1      9732096 412053 9320043    5% /

A disk can run out of inodes before it runs out of space — this happens when a filesystem has millions of small files. If df says you have space but you cannot create new files, check inodes.

Check a specific path

You can point df at a path instead of a device name:

$ df -h /var/log
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       145G   16G  122G  12% /

It will show the filesystem that path is on, which is useful when you are not sure which partition a directory lives on.

When the disk is full

If a process is reporting "no space left on device", run:

df -h

Look for any filesystem at 100% (or close to it). Then use du to find what is eating the space.