The function of the DF command in Linux is to check the disk space footprint of the filesystem on the Linux server. You can use this command to get how much space the hard disk is occupied and how much space is left.
1. Command format:
DF [Options] [file]
2. Command function:
Displays the available space for the specified disk file. If no file name is specified, the free space for all currently mounted file systems 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, not 1k=1024
-I display inode information
-K block is 1024 bytes
-l display only local file system
-M block is 1048576 bytes
--no-sync Ignore sync command
-P output format is POSIX
--sync to perform the sync command before obtaining disk information
-T File system type
Select parameters:
--block-size=< Chunk Size > specified block size
-t< file System type > display only disk information for selected file systems
-x< file System type > do not display disk information for the selected file system
--HELP Display Help information
--version Display version Information
4. Use instance:
Example 1: Displaying disk usage
Command:
Df
Output:
[root@ct1190 log]# DF
File system 1k-block already used available% mount point
/dev/sda7 19840892 890896 17925856 5%/
/DEV/SDA9 203727156 112797500 80413912 59%/opt
/dev/sda8 4956284 570080 4130372 13%/var
/dev/sda6 19840892 1977568 16839184 11%/usr
/dev/sda3 988116 23880 913232 3%/boot
Tmpfs 16473212 0 16473212 0%/dev/shm
Description
The 1th column of the output list for the DF command in Linux is the pathname of the device file that represents the file system (typically the partition on the hard disk); The 2nd column gives the number of data blocks (1024 bytes) that the partition contains, and the 3rd, 4 columns represent the number of used and available blocks of data. The user may be surprised that the sum of the 3rd, 4 column blocks is not equal to the number of blocks in column 2nd. This is because the default partition leaves a small amount of space for system administrators to use. Even if the normal user space is full, the administrator can still log in and leave the workspace needed to resolve the problem. The use% column in the list represents the percentage of normal user space usage, 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.
Example 2: Displaying disk usage in Inode mode
Command:
Df-i
Output:
[root@ct1190 log]# Df-i
File System Inode (i) (i) available (i) used% mount point
/dev/sda7 5124480 5560 5118920 1%/
/DEV/SDA9 52592640 50519 52542121 1%/opt
/dev/sda8 1280000 8799 1271201 1%/var
/dev/sda6 5124480 80163 5044317 2%/usr
/dev/sda3 255232 255198 1%/boot
TMPFS 4118303 1 4118302 1%/DEV/SHM
Description
Instance 3: Display the specified type of disk
Command:
Df-t ext3
Output:
[root@ct1190 log]# df-t ext3
File system 1k-block already used available% mount point
/dev/sda7 19840892 890896 17925856 5%/
/DEV/SDA9 203727156 93089700 100121712 49%/opt
/dev/sda8 4956284 570104 4130348 13%/var
/dev/sda6 19840892 1977568 16839184 11%/usr
/dev/sda3 988116 23880 913232 3%/boot
Description