Introduced:
The DF command in Linux can be used to display disk usage statistics for file systems currently on Linux systems. These tools make it easy to know which file systems consume much memory. In addition, if it is picked up and provides a specific file name as a parameter of the DF command, then it displays the disk usage statistics for the file system where the file resides. System administrators can use this command to know the disk usage status of various file systems on Linux so that the Linux system can be properly cleaned and maintained. The DF command is available in a customizable manner and is the most suitable for the user's output with a variety of options.
In this article, we will discuss the actual example of the DF command.
Grammar:
Let's take a look at how to use the DF command first. Here is the syntax information from the man page DF command:
- DF [OPTION] ... [FILE] ...
So we see that the DF command does not require any mandatory parameters. Non-mandatory parameter options and file parameters. Although the option parameter tells the DF command to act as defined by the specified option, the file parameter tells the DF command to print the disk usage of the file system on which the file resides.
Note: For information that is not yet familiar with this type of syntax, any parameters specified in square brackets [] are not mandatory.
Example:
1. Basic examples:
The following is how the DF command can be used in its most basic form.
- # DF
- Filesystem 1k-blocks used Available use% mounted on
- /dev/sda6 29640780 4320704 23814388 16%/
- Udev 1536756 4 1536752 1%/dev
- TMPFS 617620 888 616732 1%/run
- None 5120 0 5120 0%/run/lock
- None 1544044 156 1543888 1%/run/shm
In the above output, all the file system's disk usage statistics show that the DF command runs without any parameters. The first column specifies the name of the file system, and the second column specifies a specific file system 1k-block 1K is the total memory of 1024 bytes. And the available columns are in use, the amount of memory specified separately. Use a column to specify the percentage of memory used, and the last column "Installed" on the specified file system mount point.
2, the use of documents to obtain file system
As described in the discussion, DF can display the file system information used by the disk
Example:
- # DF Test
- Filesystem 1k-blocks used Available use% mounted on
- /dev/sda6 29640780 4320600 23814492 16%/
Another example:
- # DF Groff.txt
- Filesystem 1k-blocks used Available use% mounted on
- /dev/sda6 29640780 4320600 23814492 16%/
We used two different files (operations on the same file system) for the parameters of the DF command. The output confirms the disk usage of the file system where the DF command displays the file.
3. Display Inode Information
The output of the DF command with one-I option displays the Inode information instead of the block usage.
Example:
- # df-i
- Filesystem inodes iused IFree iuse% mounted on
- /dev/sda6 1884160 261964 1622196 14%/
- Udev 212748 560 212188 1%/dev
- Tmpfs 216392 477 215915 1%/run
- None 216392 3 216389 1%/run/lock
- None 216392 8 216384 1%/RUN/SHM
4, display all the information:
Here is an option--total, which outputs a total of each column when the output of an additional line ends when it is produced.
- # DF--total
- Filesystem 1k-blocks used Available use% mounted on
- /dev/sda6 29640780 4320720 23814372 16%/
- Udev 1536756 4 1536752 1%/dev
- Tmpfs 617620 892 616728 1%/run
- None 5120 0 5120 0%/run/lock
- None 1544044 156 1543888 1%/run/shm
- Total 33344320 4321772 27516860 14%
So, we see the end of the output, which contains an extra line that shows the total of each column.
5. Generate a readable output:
The-h option enables the output of the DF command to produce a readable format through it
- # df-h
- Filesystem Size used Avail use% mounted on
- /dev/sda6 29G 4.2G 23G 16%/
- Udev 1.5G 4.0K 1.5G 1%/dev
- Tmpfs 604M 892K 603M 1%/run
- None 5.0M 0 5.0M 0%/run/lock
- None 1.5G 156K 1.5G 1%/RUN/SHM
Therefore, we can see that the output shows the digital form of ' G ' (gigabytes), "M" (MBytes) and "K" (Kbytes). This makes the output easy to read and understand, thus making the display readable. Notice that the name of the second column has also changed, in order to make the display a readable "size".
The DF command for Linux