df Command in Linux | Explained

Linux’s “df” command presents data about the file system where each file resides. When used without any options, it displays the total amount of space available on each file system, the amount currently used, and the amount available for use.

This post will demonstrate the detailed working of the df command in Linux with the following supported content.

Let’s get started with the basics of the df command.

How Does the df Command Work in Linux?

It is always recommended to take the “help” of the command that you want to learn to get more detail about its syntax. The options come with it as shown below:

$ df --help

So, let’s see what the basic “df” command will do when you type it on the terminal:

$ df

In the above image, you can see the total, used and available disk space for all the available storage devices. The “tmpfs” represents the virtual memory, whereas the “/dev/sda2” and “/dev/sda3” are the two different partitions for the primary hard disk that it is using.

How to Use the df Command in Linux?

This section will discuss the options and examples that would be carried out using the df command.

Summarize All the Information of Mounted File System Space

You can use the “–total” option that works exactly like the basic df command; it includes a summary line at the end of the output, showing the total size and usage of all filesystems on the system. You need to follow the below syntax to run the command below:

$ df --total

Display Information in Human Readable Format

The “-h” option will help you in reading the information with ease in the “human-readable format” In this way, the format and sizes are displayed in units of kilobytes (KB), megabytes (MB), or gigabytes (GB). This can be more intuitive than the default output, which displays sizes in units of 1,024-byte blocks:

$ df -h

Display Mounted File System Space with File Type

If you want to display information about the file system on which each file is stored, including the type of each file system then you need to use the “-T” option. This will display the type of each file system in the “Type” column using the following command:

$ df -T

Display only Specific Mounted File System Space

You can display information about the file systems of a particular type on the system by using the “-t” option. For example, displaying the specific information linked with the type “tmpfs”, then you can type.

$ df -t tmpfs

You can see that all the information only linked with the “tmpfs” file system is shown in the above image.

Exclude Specific Mounted File System Space

The “x” option can exclude file systems of a particular type from the output of the df command. When used with the -x option, the df command will not show information about file systems of the specified type as shown below:

$ df -x tmpfs

Display Inode Information

In Linux, you can use the “-i” option along with the df command to display information about the number of inodes on each file system. Inodes store information about files and directories on a file system. Each file and directory on a file system uses one or more inodes, and the number of inodes on a file system determines the maximum number of files and directories that can be stored on it.

$ df -i

In the above image, you can see the total number of inodes on each file system, the number of inodes currently being used, the number of available inodes, and the percentage of inodes being used.

Display Information on all File Systems

In Linux, the “-a” option can be used to display information about all file systems on the system, including file systems that are not currently mounted, as shown below:

$ df -a

This was all about the df command in Linux.


The “df” command in Linux displays information about file systems on a system, including total size, used space, available space, and percentage of space used. By default, it shows information about file systems currently mounted on the system, including the mount point (the directory where the file system is mounted). The usage of the df command and its different options have been discussed in detail.