English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux df command

Linux Command大全

The Linux df command (English full name: disk free) is used to display the disk usage statistics of the file system on the Linux system.

Syntax

df [options]... [FILE]...
  • File-a, --all Include all file systems with 0 Blocks
  • File--block-size={SIZE} Use {SIZE} size Blocks
  • File-h, --human-readable Use human-readable format (the default is not to add this option...)
  • File-H, --si Similar to -h, but use 1000 Instead of using 1024
  • File-i, --inodes List inode information, do not list used blocks
  • File-k, --kilobytes is like --block-size=1024
  • File-l, --local Limit the listed file structure
  • File-m, --megabytes is like --block-size=1048576
  • File--no-sync Do not sync before getting information (default)
  • File-P, --portability Use POSIX output format
  • File--sync Sync before getting information
  • File-t, --type=TYPE Limit the list of file systems to TYPE
  • File-T, --print-type Show the format of the file system
  • File-x, --exclude-type=TYPE Limit the list of file systems to not display TYPE
  • File-v (ignore)
  • File--help Display this help and exit
  • File--version Output version information and exit

Online example

Displays the disk usage statistics of the file system:

# 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 

The first column specifies the name of the file system, and the second column specifies a particular file system1K-block1K is1024Total memory in bytes. The and available columns specify the amount of memory being used and available, respectively.

Specify the percentage of memory used by the column, while the last column "mounted on" specifies the mount point of the file system.

df can also display filesystem information about disk usage:

# df test 
Filesystem     1K-blocks    Used      Available Use% Mounted on 
/dev/sda6       29640780    4320600   23814492  16%       / 

With a-The df command with the i option displays inode information instead of block usage.

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 

Display all information:

# 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% 

We see that the end of the output includes an additional line that shows the total of each column.

-The h option, through which it can produce a readable format of the df command output:

# 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 

We can see that the output displays numbers in the form of 'G' (gigabytes), 'M' (megabytes), and 'K' (kilobytes).

This makes the output easy to read and understand, making it readable. Note that the names in the second column have also changed to make the display "size" readable.

Linux Command大全