Skip to content

The Disk Free Command

Static Badge

The df (short for Disk Free) command lists all attached storage on our local system, including any removable storage and remote network shares that are mounted locally. Here is a typical df output:

Example command output:
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           3.2G  2.7M  3.2G   1% /run
efivarfs        192K  117K   71K  63% /sys/firmware/efi/efivars
/dev/nvme0n1p2   92G   38G   49G  44% /
tmpfs            16G  1.2G   15G   8% /dev/shm
tmpfs           5.0M   16K  5.0M   1% /run/lock
tmpfs            16G     0   16G   0% /run/qemu
/dev/nvme0n1p1  511M   31M  481M   6% /boot/efi
/dev/nvme0n1p3  469G  279G  167G  63% /home
/dev/nvme0n1p4  1.3T  561G  646G  47% /data
As seen in the example output, the df command displays file system details across the following columns:

Column Description
Filesystem The storage device name or path (e.g., physical /dev/nvme... device or virtual system mount).
Size Total storage capacity allocated to the device or partition.
Used Space currently occupied by data.
Avail Remaining free space available for write operations.
Use% Percentage of total storage capacity currently occupied.
Mounted on The absolute system path (mount point) where the storage is attached relative to Root (/).

Command Syntax Examples

The example above uses the Human Readable flag:

df -h
To list an additional row to display the total size of all connected storage:

df --total
To list the file system type of each storage device / file system:

df -T
This flag will add an additional column, after the Filesystem column, listing the file system type. This is helpful if we want to use the next flag: to exclude one or more file system types from the output:

df -x <type> 

Where <type> is one of the available file system types, typically: ext4, vfat, tmpfs, etc. You can use the output of the -T flag to find the available file system types on your local system.

To list a specific storage device (mount point), we can run:

df /home

Combining the flags

We can combine a few flags together to get the information we need. Say we want the output to be human readable, include the total size of the connected storage and exclude the tmpfs file system type:

df -h --total -x tmpfs

CONCLUSION

This is only a short introduction to the df command. You can find out more by reading the manual page (man df) or by researching online for specific scenarios and use cases.