Using df command in Linux


Linux provides various tools to check disk space usage on file system.

df command is one of them which stands for disk free. It displays the amount of disk space available on a filesystem. By using this you can get a full report which includes size, used,  available, use %, and mount location of the disk.

In this article, we will discuss the usage of the df command on a Linux system with some examples.

Syntax of df command

How to use df command on a Linux system, the syntax is given below –

df [Option].. File..

You can find the detailed list of options on its man page.

How to display the disk space usage by the mounted file system

When the df command is used without any argument it shows the summary of disk space usage by the currently mounted filesystems. I will recommend using the option -h with the df command so that you get the output in human-readable form.

Now use the following command in your terminal –

df -h

You can see the output of this command in the given image –

How to check disk space usage of a specific filesystem

If you want to view disk space usage of a specific filesystem lets say /var then use the following command in your terminal –

df -h /var

Now see the output –

How to display the filesystem type in the output

To see the filesystem type of all the filesystems displayed using the df command, use the following command –

df -hT

You will see a new column with the name Type that will show the filesystem type –

How to display the information of all the filesystem

Using option -a with df command will display the information of all the filesystems. This is very much similar to using the df command without any argument.

Now use the following command to see the information of all the filesystems –

df -ah

To know more about the df command see its man page in your terminal by using –

man df

Conclusion

This article explains how to use the df command on a Linux system. Now if you have a query related to this then write to us in the comments below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.