The df command comes from disk free and it is used in order to find out the amount of free disk space available on Linux and Unix-like systems. It is also useful in order to understand the filesystems that have been mounted.
Using the df command is quite straightforward. Just type df in your terminal or df with the required arguments. (example: df -i or df -h etc.)
df command examples
df
Just using df without any arguments will display the amount of free space on each currently mounted file system. You can also specify a file name argument to see the free space on a specific mounted file system.
df -h
The -h argument outputs the disk usages and values in human-readable form.
df -i
The -i argument is useful to see the number of free inodes.
df /path/to/directory/or/file
This allows you to show the filesystem and its disk usage of the given file or directory.
df -x tmpfs
If you’d like to show everything bug exclude the specified type, just use the above example with the -x argument followed by the name of the filesystem.
And of course, you can even combine arguments, like adding -h to other commands to get human readable forms.
df -x tmpfs -h
df /dev/sdc1 -h
df command columns
Here’s what each column means when the df command outputs stuff:
Filesystem | Size | used | Available | Percentage used | Mounted on |
the name of the disk partition | total size of that file system | the amount of space used in that file system | total amount of space available in that file system | the percentage of available space | the directory in which the file system appears |
That’s about it!
And that’s about it regarding the df command. If you found this small post useful, share it! It might help other people too!