Common Linux commands (27th)-df
In linux, the df command is used to check the disk space usage of the file system of the linux server. You can use this command to obtain the space occupied by the hard disk and the remaining space.
1.Command Format:
Df [Option] [file]
2.Command function:
Displays the available space of the specified disk file. If no file name is specified, the available space of all mounted file systems will be displayed. By default, the disk space is displayed in 1KB. Unless the environment variable POSIXLY_CORRECT is specified, the disk space is displayed in 512 bytes.
3.Command parameters:
Required parameters:
-A list of all file systems
-H: Easy reading mode display
-H is equal to "-h", but the formula is 1 K = 1000, instead of 1 K = 1024.
-I: displays inode information.
The-k block is 1024 bytes.
-L only displays the local file system
-The m block is 1048576 bytes.
-- No-sync ignore the sync command
-P output format is POSIX
-- Sync: run the sync command before obtaining disk information.
-T file system type
Select parameters:
-- Block-size = <block size> specifies the block size.
-T <file system type> only displays the disk information of the selected File System
-X <file system type> does not display the disk information of the selected File System
-- Help: displays help information.
-- Version: displays version information.
4.Command instance:
Instance 1. Display disk usage
Command: df
[Root @ CT1190 log] # df file system 1 K-available block used % 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%/boottmpfs 16473212 0 16473212 0%/dev/shm
Note:
In linux, column 1st of the output list of the df command represents the path name of the device file corresponding to the file system (usually the partition on the hard disk ); column 2nd shows the number of data blocks (1024 bytes) contained in the partition. Column 3 and 4 indicate the number of used and available data blocks, respectively. The user may be surprised that the sum of the blocks in column 3 and 4 is not equal to the number of blocks in column 3. This is because by default, each partition leaves a small amount of space for the system administrator to use. Even if the common user space is full, the administrator can still log on and leave the workspace required to solve the problem. The Use % column in the list indicates the percentage of space used by normal users. Even if the number reaches 100%, the partition still has space for the system administrator. Finally, the Mounted on column indicates the mount point of the file system.
Instance 2. Display disk usage in inode Mode
Command: df-I
[Root @ CT1190 log] # df-I file system Inode (I) used (I) available (I) % 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 34 255198 1%/boottmpfs 4118303 1 4118302 1%/dev/shm
Instance 3. Display disks of the specified type
Command: df-t ext3
[Root @ CT1190 log] # df-t ext3 File System 1 K-block 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
Instance 4. List the I node usage of each FILE SYSTEM
Command: df-ia
[Root @ CT1190 log] # df-ia file system Inode (I) used (I) available (I) % mount point/dev/sda7 5124480 5560 5118920 1%/proc 0 0 0-/procsysfs 0 0 0-/sysdevpts 0 0 0 0-/dev/pts/dev/sda9 52592640 50519 52542121 1%/opt/dev/sda8 1280000 8799 1271201 1%/var/dev/sda6 5124480 80163 5044317 2% 255232/usr/dev/sda3 255198 34 1% 4118303/boottmpfs 4118302 1 1%/dev /shmnone 0 0-/proc/sys/fs/binfmt_misc
Instance 5. list file system types
Command: df-T
Root @ CT1190 log] # df-T file system type 1 K-block used available % mount point/dev/sda7 ext3 19840892 890896 17925856 5%/dev/sda9 ext3 203727156 93175692 100035720 49%/opt/dev/sda8 ext3 4956284 570104 4130348 13%/var/dev/sda6 ext3 19840892 1977568 16839184 11%/usr/dev/sda3 ext3 988116 23880 913232 3%/boottmpfs tmpfs 16473212 0 16473212 0%/dev/shm
Instance 6. display the current disk space and usage in a more readable manner
[Root @ CT1190 log] # df-H file system capacity in use available % mount point/dev/sda7 19G 871 M 18G 5%/dev/sda9 195G 89G 96G 49%/opt/dev/sda8 4.8G 557 M 4.0G 13%/var/dev/sda6 19G 1.9G 17G 11%/usr/dev/sda3 965 M 24 M 892 M 3%/boottmpfs 16G 0 16G 0%/dev/shm [root @ CT1190 log] # df-H file system capacity in use available % mount point/dev/sda7 21G 913 M 19G 5% // dev/sda9 209G 96G 103G 49%/opt/dev/sda8 5.1G 584 M 4.3G 13%/var/dev/sda6 21G 2.1G 18G 11%/usr/dev/sda3 1.1G 25 M 936 M 3%/boottmpfs 17G 0 17G 0%/dev/shm [root @ CT1190 log] # df-lh file system capacity used available % mount point/dev/sda7 19G 871 M 18G 5%/dev/sda9 195G 89G 96G 49%/opt/dev/sda8 4.8G 557 M 4.0G 13%/var/dev/sda6 19G 1.9G 17G 11%/usr/dev/sda3 965 M 24 M 892 M 3%/boottmpfs 16G 0 16G 0%/dev/shm [root @ CT1190 log] # df-k file system 1 K-block used available % mount point/dev/sda7 19840892 890896 17925856 5%/dev/sda9 203727156 93292572 99918840/opt /dev/sda8 4956284 570188 4130264 13%/var/dev/sda6 19840892 1977568 16839184 11%/usr/dev/sda3 988116 23880 913232 3%/boottmpfs 16473212 0 16473212 0%/dev/shm
Note:
-H display the disk space and usage in a more readable manner
-H is the same as the preceding-h Parameter. However, in root mode, 1000 instead of 1024 is used for capacity conversion.
-K Displays disk usage in units
-L displays the disk space usage of the local partition. If the nfs server has a remote server disk, add-l to df and the system displays the results after filtering the nsf drive.
-I: displays inode usage. Linux uses a pointer-like method to manage disk space shadows. This is also a key application.