One Linux command per day (4) DF command

Source: Internet
Author: User
Tags disk usage

The function of the DF command in Linux is to check the disk space usage of the Linux server's file system. You can use this command to get information about how much space the hard disk is taking up, and how much space is left.

1. Command format:

DF [Options] [file]

2. Command function:

Displays the free space for the specified disk file. If no file name is specified, all available space for the currently mounted file system will be displayed. By default, disk space is displayed in 1KB, unless the environment variable posixly_correct is specified, which is displayed in 512-byte units

3. Command parameters:

Necessary parameters:

-A All File system list

-h easy to read mode display

-H equals "-H", but the formula, 1k=1000, rather than 1k=1024

-I display inode information

-K block is 1024 bytes

-L show local file system only

-M block is 1048576 bytes

--no-sync Ignore sync command

-P output format POSIX

--sync perform the sync command before obtaining the disk information

-T File system type

Select parameters:

--block-size=< Chunk Size > specified chunk size

-t< file system type > show only disk information for selected file systems

-x< file System type > does not display disk information for the selected file system

--HELP Display Help information

--version displaying version information

4. Usage examples:

Example 1: Displaying disk usage

Command: DF

Output:

[Email protected]:/home/work/test# Dffilesystem 1K-blocks used Available use%Mounted Onudev2004632        4   2004628   1% /Devtmpfs403064     5260    397804   2% /Run/dev/sda1101016992 14979220  80883368   -% /None4        0         4   0%/sys/fs/Cgroupnone5120        0      5120   0%/run/LockNone2015304       the   2015124   1%/run/Shmnone102400        the    102348   1%/run/User[email protected]:/home/work/test#

Description

The 1th column of the output list of the DF command in Linux is the pathname of the device file that represents the file system (typically the partition on the hard disk), and the 2nd column gives the number of blocks (1024 bytes) that the partition contains, and the 3rd, 4 columns indicate the number of data blocks used and available respectively. Users may be surprised that 3rd, the sum of 4 column blocks is not equal to the number of blocks in the 2nd column. This is because each of the default partitions leaves a small amount of space for the system administrator to use. The administrator can log in and leave the workspace required to resolve the problem, even when the normal user space is full. The use% column in the list represents the percentage of normal user space used, even if the number reaches 100%, and the partition still leaves room for the system administrator to use. Finally, the mounted on column represents the mount point of the file system.

Case 2: Displaying disk usage in Inode mode

Command: Df-i

Output:

[Email protected]:/home/work/test# DF-ifilesystem inodes iused IFree iuse%Mounted Onudev501158    466  500692    1% /Devtmpfs503826   1126  502700    1% /Run/dev/sda16422528 432572 5989956    7% /None503826      2  503824    1%/sys/fs/Cgroupnone503826      3  503823    1%/run/LockNone503826      6  503820    1%/run/Shmnone503826      to  503795    1%/run/User[email protected]:/home/work/test#

Example 3: Displaying a specified type of disk

Command: Df-t ext3

Output:

[Email protected]:/home/work/test# DF-t ext4filesystem     1K-blocks     used Available use% mounted on< /C3>/DEV/SDA1      10101699214979240  80883348  %/[email Protected]:

Example 4: List I node usage for each file system

Command: Df-ia

Output:

[Email protected]:/home/work/test# DF-iafilesystem inodes iused IFree iuse%Mounted ONSYSFS0      0       0- /Sysproc0      0       0- /Procudev501158    466  500692    1% /devdevpts0      0       0-/dev/Ptstmpfs503826   1126  502700    1% /Run/dev/sda16422528 432572 5989956    7% /None503826      2  503824    1%/sys/fs/Cgroupnone0      0       0-/sys/fs/fuse/Connectionsnone0      0       0-/sys/kernel/Debugnone0      0       0-/sys/kernel/Securitynone503826      3  503823    1%/run/LockNone503826      6  503820    1%/run/Shmnone503826      to  503795    1%/run/Usernone0      0       0-/sys/fs/pstoresystemd0      0       0-/sys/fs/cgroup/SYSTEMDGVFSD-fuse0      0       0-/run/user/ +/Gvfs[email protected]:/home/work/test#

Example 5: List types of file systems

Command: DF-T

Output:

[Email protected]:/home/work/test# DF-Tfilesystem Type 1K-blocks used Available use%mounted Onudev Devtmpfs2004632        4   2004628   1% /Devtmpfs Tmpfs403064     5260    397804   2% /Run/DEV/SDA1 EXT4101016992 14979256  80883332   -% /None Tmpfs4        0         4   0%/sys/fs/Cgroupnone Tmpfs5120        0      5120   0%/run/LockNone Tmpfs2015304       the   2015124   1%/run/Shmnone Tmpfs102400        the    102348   1%/run/User[email protected]:/home/work/test#

Example 6: Display current disk space and usage in an easier-to-read manner

Command:

Output:

[Email protected]:/home/work/test# DF-hfilesystem Size used Avail use%Mounted Onudev2.0G4.0K2.0G1% /Devtmpfs 394M5.2M389M2% /Run/DEV/SDA1 97G 15G 78G -% /None4.0K0  4.0K0%/sys/fs/Cgroupnone5.0M     0  5.0M   0%/run/LockNone2.0G 180K2.0G1%/run/shmnone 100M 52K 100M1%/run/User[email protected]:/home/cgy/work/test# DF-hfilesystem Size used Avail use%Mounted Onudev2.1G4.1k2.1G1% /Devtmpfs 413M5.4M408M2% /Run/DEV/SDA1 104G 16G 83G -% /None4.1k0  4.1k0%/sys/fs/Cgroupnone5.3M     0  5.3M   0%/run/LockNone2.1G 185k2.1G1%/run/shmnone 105M 54k 105M1%/run/User[email protected]:/home/cgy/work/test# DF-lhfilesystem Size used Avail use%Mounted Onudev2.0G4.0K2.0G1% /Devtmpfs 394M5.2M389M2% /Run/DEV/SDA1 97G 15G 78G -% /None4.0K0  4.0K0%/sys/fs/Cgroupnone5.0M     0  5.0M   0%/run/LockNone2.0G 180K2.0G1%/run/shmnone 100M 52K 100M1%/run/User[email protected]:/home/cgy/work/test# DF-Kfilesystem 1K-blocks used Available use%Mounted Onudev2004632        4   2004628   1% /Devtmpfs403064     5260    397804   2% /Run/dev/sda1101016992 14979276  80883312   -% /None4        0         4   0%/sys/fs/Cgroupnone5120        0      5120   0%/run/LockNone2015304       the   2015124   1%/run/Shmnone102400        the    102348   1%/run/User[email protected]:/home/work/test#

Description

-H more Current disk space and usage to display in a more readable manner

The-h parameter is the same on the-H root, but at the time of the radical conversion, the capacity is converted by 1000 instead of 1024.

-K displays disk usage in units

-L shows the disk space usage of the local partition, if the server NFS the disk of the remote server, then the system displays the result after the filter NSF drive after adding-l to DF

-I displays the usage of the inode. Linux uses a pointer-like approach to managing disk space mapping. This is also a more critical application

One Linux command per day (4) DF command

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.