TrumanWong

df

Display disk related information

Supplementary instructions

df command is used to display the available disk space on a disk partition. The default display unit is KB. You can use this command to obtain information such as how much space is occupied on the hard disk and how much space is currently left.

grammar

df(options)(parameters)

Options

-a or --all: include all file systems;
--block-size=<block size>: Display the number of blocks in the specified block size;
-h or --human-readable: Display information in a more readable way;
-H or --si: The same as the -h parameter, but when calculating, 1000 Bytes is used as the conversion unit instead of 1024 Bytes;
-i or --inodes: Display inode information;
-k or --kilobytes: specifies the block size to be 1024 bytes;
-l or --local: only display the local file system;
-m or --megabytes: Specify the block size to be 1048576 bytes;
--no-sync: Do not execute the sync command before obtaining disk usage information. This is the default value;
-P or --portability: use POSIX output format;
--sync: Execute the sync command before obtaining disk usage information;
-t<file system type> or --type=<file system type>: only display disk information of the specified file system type;
-T or --print-type: displays the file system type;
-x<file system type> or --exclude-type=<file system type>: Do not display disk information of the specified file system type;
--help: display help;
--version: Display version information.

Parameters

File: Specifies a file on the file system.

Size format

Displayed values are in units of the first available SIZE in the --block-size and DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables. Otherwise, the units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).

SIZE is an integer and optional unit (example: 10M is 10 * 1024 * 1024). Units are K, M, G, T, P, E, Z, Y (power of 1024) or KB, MB, ... (power of 1000).

Example

Check the system disk device, the default unit is KB:

[root@LinServ-1 ~]# df
File System 1K-Block Used Available % Mount Point Used
/dev/sda2 146294492 28244432 110498708 21% /
/dev/sda1 1019208 62360 904240 7% /boot
tmpfs 1032204 0 1032204 0% /dev/shm
/dev/sdb1 2884284108 218826068 2518944764 8% /data1

Use the -h option to display in units above KB for high readability:

[root@LinServ-1 ~]# df -h
File System Capacity Used Available % Used Mount Points
/dev/sda2 140G 27G 106G 21% /
/dev/sda1 996M 61M 884M 7% /boot
tmpfs 1009M 0 1009M 0% /dev/shm
/dev/sdb1 2.7T 209G 2.4T 8% /data1

View all file systems:

[root@LinServ-1 ~]# df -a
File System 1K-Block Used Available % Mount Point Used
/dev/sda2 146294492 28244432 110498708 21% /
proc 0 0 0 - /proc
sysfs 0 0 0 - /sys
devpts 0 0 0 - /dev/pts
/dev/sda1 1019208 62360 904240 7% /boot
tmpfs 1032204 0 1032204 0% /dev/shm
/dev/sdb1 2884284108 218826068 2518944764 8% /data1
none 0 0 0 - /proc/sys/fs/binfmt_misc

Displays the amount of free space in the public directory, as shown in the following output:

df public
# Filesystem 1K-blocks Used Available Use% Mounted on
# /dev/loop0 18761008 15246924 2554392 86% /d Avail