Instruction: DF
Check the disk space usage of the file system
You can view the total capacity, usage space, remaining space, mount location, and so on for all mounted disks
Syntax:# DF [OPTION] [FILE]
File is an optional list of one or more path names, such as selecting this option to display disk usage for the file system where the file resides
Ps:
1: All users have permission to use the DF command
2: Disk space is displayed by default in 1KB
3: Default display of available space for all currently mounted file systems
4: Super-privileged users will find that a partition will have more than 100% capacity when using the DF command for the following reasons:
The Linux system retains 10% of the space for super users. This allows the system administrator to work properly when the hard disk is close to 100% capacity
Parameters:
-A: Displays disk usage for all file systems (including 0 blocks of file systems, such as/proc file system)-B: Used to specify the unit of report utility (default block size is 1KB)-H: Displays the file system size in the appropriate units (KB, MB, GB), easy to read-H: with "- H ", displays the file system size in the appropriate units (KB, MB, GB), but with 1000 capacity conversion-I: Displays inode index node usage instead of disk block-K: chunks Show disk space usage in kilobytes (1024 bytes) (default unit)-L: Show only disk space usage on the local file system-M: Display in megabytes-P: Using the POSIX output format-t: Displays disk space usage for the specified type of file system-T: Displays the file system type (such as EXT4)-X: Displays disk space usage for file systems that are not of the specified type (as opposed to the T option)
--HELP: Display Help information--total: Show total--sync: Perform the sync command before obtaining the disk information--no-sync: Ignore sync command--version: Display version information
Ps:
1, the default isDisplay by K
2, without any parameters, the user will get the free space of each mounted device on the local system
Description of DF Command display
# DF
Filesystem 1k-blocks used Available use% mounted on/dev/sda2 9071088 1030988 7579300 12%/TMPFS 957244 0 957244 0%/dev/shm/dev/sda1 198337 26817 161280 15% /boot/dev/sda5 9351388 151940 8724416 2%/main
Filesystem: Specifies the name of the file system, or the path name of the device file that corresponds to the file system
1k-blocks: The number of data blocks (1024 bytes) that the specified file system contains
Used: Number of data blocks used
Available: Number of available data blocks
use%: Percentage of space usage
Mounted on: Specifies the mount point of the file system
Ps: When using this directive, used + Available < 1k-blocks, because each partition is left with a small amount of space for the system administrator to use
Instance:
1. Display disk usage in an easier-to-read manner
# df-h
Filesystem Size used Avail use% mounted on/dev/sda2 8.7G 1007M 7.3G 12%/tmpfs 935M 0 935M 0%/dev/shm/dev/sda1 194M 27M 158M 15%/boot/dev/sda5 9.0G 149M 8.4G 2%/doiido
2. Display all the partitions of the system
# df-a
Filesystem 1k-blocks used Available use% mounted on/dev/sda2 9071088 1030988 7579300 12%/proc 0 0 0 -/procsysfs 0 0 0 -/sysdevpts 0 0 0 -/dev/ Ptstmpfs 957244 0 957244 0%/dev/shm/dev/sda1 198337 26817 161280 15%/ Boot/dev/sda5 9351388 151940 8724416 2%/doiidonone 0 0 0 -/proc/sys/fs /binfmt_misc
3. Display Inode Index node usage
Sometimes the file system still has space, but not enough inode, so it is not possible to add files
# df-i
Filesystem inodes iused IFree iuse% mounted on/dev/sda2 577088 32829 544259 6%/tmpfs 239311 1 239310 1%/dev/shm/dev/sda1 51200-51162 1%/boot/dev/sda5 594512 11 594501 1%/doiido
4. Display disk usage in K units
# df-k
Filesystem 1k-blocks used Available use% mounted on/dev/sda2 9071088 1030992 7579296 12%/ Tmpfs 957244 0 957244 0%/dev/shm/dev/sda1 198337 26817 161280 15%/boot /dev/sda5 9351388 151940 8724416 2%/doiido
5. Display the file system type.
# df-t
Filesystem Type 1k-blocks used Available use% mounted on/dev/sda2 ext4 9071088 1030992 7579296 12%/tmpfs tmpfs 957244 0 957244 0%/dev/shm/dev/sda1 ext4 198337 26817 161280 15%/boot/dev/sda5 ext4 9351388 151940 8724416 2%/doiido
6. Display the specified type of disk
# df-t Ext4
Filesystem 1k-blocks used Available use% mounted on/dev/sda2 9071088 1030992 7579296 12%// DEV/SDA1 198337 26817 161280 15%/boot/dev/sda5 9351388 151940 8724416 2%/doiido
7. Display disk usage in megabytes
# DF-BM
Filesystem 1m-blocks used Available use% mounted on/dev/sda2 8859M 1007M 7402M 12% /TMPFS 935M 0M 935M 0%/dev/shm/dev/sda1 194M 27M 158M 15%/boot/dev/sda5 9133M 149M 8520M 2%/doiido
Use # df-m is the same, but the number is not added after the unit, shown as follows
Filesystem 1m-blocks used Available use% mounted on/dev/sda2 8859 1007 7402 12% /TMPFS 935 0 935 0%/dev/shm/dev/sda1 194 149 158 15%/boot/dev/sda5 9133 8520 2%/doiido
8, display the total amount of use
# DF--total
Filesystem 1k-blocks used Available use% mounted on/dev/sda2 9071088 1030992 7579296 12%/ Tmpfs 957244 0 957244 0%/dev/shm/dev/sda1 198337 26817 161280 15%/boot /dev/sda5 9351388 151940 8724416 2%/doiidototal 19578057 1209749 17422236 7%
9, the use of documents to obtain file system
9.1:# Df/doiido
Filesystem 1k-blocks used Available use% mounted on/dev/sda5 9351388 151940 8724416 2%/doiido
9.2:
# Cd/doiido
# DF Dodo
Filesystem 1k-blocks used Available use% mounted on/dev/sda5 9351388 151940 8724416 2%/ Doiido
Here you will find that using DF for a directory or file of the same file system will enter the disk usage in the file system
Linux command Details DF Check the file system disk space usage