The “df” is a standard command in Linux, and Unix-like systems termed “Disk Filesystem.” It is used to display consumed and available disk space for the specific file system.
Whenever you run this Linux command-line utility, it displays the amount of used and available blocks, total disk space, and a summary of where the file system is mounted.
In short, the dubbed “df” command is a helpful tool to get disk space information having file name arguments.
df Command Syntax:
Syntax of the “df” command-line tool is:
Execute the “df” command in the terminal without any filename. It will print the complete statistics of disk space in tabular form, including total, used, available, and the root directory where files are mounted on.
df Command Options:
Several options come under the flag of the “df” command.
Print File System Type:
When we use the “-T” option in the terminal, it will print the machine’s file system type in output.
As you can see, a new column “Type” is displayed on the terminal with other information.
Include Particular File System Type:
In the “-T” option’s section (mentioned above), we have seen a column containing file system type. Select any specific file system type if you want to display its output separately. For this “-t” option is used. When you used this option with file-name, it will print the output of that particular file system.
For example, if we want to print the disk space information of the file system “devtmpfs.” So, the command would be:
Exclude Particular File System Type:
To exclude any particular file system type from the result, use the “-x” option with the file type. Once you execute this command option, it will print all other file system types except this particular one.
For example, if we want to exclude the “devtmpfs” file type from the output, the command would be:
Display Output in Human readable form:
The “df” command is a user-friendly tool; it supports an easily readable option for humans. For this, use the “-h” option in the command-line, and the output displayed on the terminal will be understandable for the human.
You can see, it displayed the size of powers GBs as G, MBs as M, and KBs as K. Now, it is easy to understand the output.
Display Inode Information:
The “-i” option is used to show Inode information in the terminal instead of disk space information. When you run this option, it will show the “Inode” column along with “IUsed” and “IFree” columns.
Display Grand Total Size:
Use the “–total” option to print the total for size, availability, and used space.
Print Help Message:
The “help” option is used to print the help message about the “df” command and its supported options.
To print version information of the “df” command tool, use the “version” option.
Some Other Useful Options:
- -l, –local: It will list down disk space information of the local file system only.
- -P, –portability: When type this “df” option in the terminal, it will utilize only POSIX output format.
- -a, –all: It is used to include all duplicate and dummy files whether they are having with zero block sizes.
- -b, –block-size=SIZE: When we use the “-b” option in the terminal, it will scale sizes by SIZE.
- -H: This option performs the same functionality as the “-h” option. But it takes the power of 1000 instead of 1024.
The “df” is a standard tool to display disk space information in Linux-like systems. It is abbreviated as “Disk Filesystem.” This tutorial has included a detailed note about the working of the “df” command in the terminal and listed its several options.