df command in linux with example

This article is a follow-up to the last 90 Linux Commands frequently used by Linux Sysadmins post. Every week, as time permits, I will publish articles on ~90 commands geared to Linux sysadmins and Linux power users.

Use the df command when you need to know how much space is available on a particular filesystem or to see an overview of mounted filesystems.

The df command in Linux and other Unix-like systems.

df command (for less Diski Fri) is used on Linux and other Unix-like systems to show the amount of free disk space available and to understand the filesystem that is mounted.

df Displays the amount of free space on the file system containing each filename argument. If no filename is provided, free space is displayed on all currently mounted file systems.


df without any logic and df -i (show free inodes) output.

df column

Filesystem
Disk partition name.

Size
The total size of the file system.

used
The total amount of space allocated to existing files in the file system.

Available
The total amount of available space within the file system.

Percentage used
The percentage of available space that is currently allocated to all files on the file system.

Mounted on
The directory in which the file system appears.

df command example

To display all file systems and their disk usage, use:

df

To show all file systems and their disk usage in human-readable form, use:

df -h

To show the file system and its disk usage to which a given file or directory is, use:

df /path/to/directory_or_file

To display statistics on the number of free inodes, use:

df -i

To show the filesystem but exclude the specified type, use:

df -x tmpfs

Useful reading of the df command:

Leave a Comment