The DF command for Linux

Source: Internet
Author: User
Tags readable disk usage

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:

    1. 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.

  1. # DF
  2. Filesystem 1k-blocks used Available use% mounted on
  3. /dev/sda6 29640780 4320704 23814388 16%/
  4. Udev 1536756 4 1536752 1%/dev
  5. TMPFS 617620 888 616732 1%/run
  6. None 5120 0 5120 0%/run/lock
  7. 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:

    1. # DF Test
    2. Filesystem 1k-blocks used Available use% mounted on
    3. /dev/sda6 29640780 4320600 23814492 16%/

Another example:

    1. # DF Groff.txt
    2. Filesystem 1k-blocks used Available use% mounted on
    3. /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:

  1. # df-i
  2. Filesystem inodes iused IFree iuse% mounted on
  3. /dev/sda6 1884160 261964 1622196 14%/
  4. Udev 212748 560 212188 1%/dev
  5. Tmpfs 216392 477 215915 1%/run
  6. None 216392 3 216389 1%/run/lock
  7. 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.

  1. # DF--total
  2. Filesystem 1k-blocks used Available use% mounted on
  3. /dev/sda6 29640780 4320720 23814372 16%/
  4. Udev 1536756 4 1536752 1%/dev
  5. Tmpfs 617620 892 616728 1%/run
  6. None 5120 0 5120 0%/run/lock
  7. None 1544044 156 1543888 1%/run/shm
  8. 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

  1. # df-h
  2. Filesystem Size used Avail use% mounted on
  3. /dev/sda6 29G 4.2G 23G 16%/
  4. Udev 1.5G 4.0K 1.5G 1%/dev
  5. Tmpfs 604M 892K 603M 1%/run
  6. None 5.0M 0 5.0M 0%/run/lock
  7. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.