Linux Command details df check disk space usage of the file system
Command: df
Check disk space usage of the file system
You can view the total capacity, usage, remaining space, and mount location of all mounted disks.
Syntax: # df [OPTION] [FILE]
FILE is an optional list of one or more path names. If this option is selected, the disk usage of the FILE system where the FILE is located is displayed.
Ps:
1: All Users have the permission to use the df command.
2: disk space is displayed in 1KB by default.
3: by default, the available space of all mounted file systems is displayed.
4: When a super permission user uses the df command, the capacity of a partition will exceed 100%. The reason is as follows:
Linux saves 10% of the space for Super Users. In this way, when the disk capacity is close to 100%, the system administrator can still work normally.
Parameters:
-A: displays the disk usage of all file systems (including 0 block file systems, such as/proc file systems)-B: used to specify the actual unit of the report (the default block size is 1 KB)-h: displays the file system size in a suitable unit (KB, MB, GB) for ease of reading-H: like "-h", the size of the file system is displayed in a proper unit (KB, MB, GB), but 1000 is used for capacity conversion-I: displays inode index node usage, instead of disk block-k: the disk space usage (default unit) is displayed in KB (1024 bytes).-l: only display the disk space usage of the local file system-m: In MB-P: Use POSIX output format-t: display disk space usage of a specified type of file system-T: display file system type (such as ext4)-x: displays the disk space usage of a file system that is not of the specified type (opposite to the t option)
-- Help: Display help information -- total: display total -- sync: run the sync command -- no-sync: Ignore the sync command -- version: display version information before obtaining disk information.
Ps:
1. The default value is k.
2. Without any parameters, the user will obtain free space for each mounted device on the local system.
Df command display details
# 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. It can also be understood as the path name of the device file corresponding to the file system.
1K-blocks: number of data blocks (1024 bytes) contained in the specified file system
Used: number of Used data blocks
Available: number of Available data blocks
Use %: Percentage of space used
Mounted on: mount point of the specified file system
Ps: When a common user uses this command, Used + Available <1K-blocks, because by default, each partition leaves a small amount of space for the system administrator to use.
Instance:
1. Display disk usage in a more readable 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 system partitions
# Df-
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 there is still space in the file system, but there is not enough inode 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 38 51162 1% /boot/dev/sda5 594512 11 594501 1% /doiido
4. Display disk usage in k
# 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 disks of the specified type
# 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 MB
# 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
The use of # df-m is the same, but the number is not followed by a unit, the display is 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 27 158 15% /boot/dev/sda5 9133 149 8520 2% /doiido
8. display the total usage
# 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. Get the usage of the file system through the file
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
If df is used for a directory or file in the same file system, the disk usage of the file system is entered.