Linux foundation: df command summary

This article only summarizes some common usage. For more details, see man df and df --help.

df command

df command is used to display the disk usage statistics of file system on Linux system.

df command mainly reads data from Super block of each file system.

Grammatical format

Usage: df [OPTION]... [FILE]...

Selection specification

OPTION Explain
-a Display all file system information, including system specific / proc, / sysfs and other file systems;
-h Use the KB, MB or GB and other units that people are accustomed to display capacity by themselves;
-T Display the file system name of the partition;
-i It does not need to display the capacity of the hard disk, but the number of inode s;

Example

# Show disk space
[root@backup-server ~]# df 
Filesystem              1K-blocks      Used Available Use% Mounted on
/dev/mapper/centos-root  16558080   2333568  14224512  15% /
devtmpfs                  1928488         0   1928488   0% /dev
tmpfs                     1940368         0   1940368   0% /dev/shm
tmpfs                     1940368      8988   1931380   1% /run
tmpfs                     1940368         0   1940368   0% /sys/fs/cgroup
/dev/sda1                  201380    123660     77720  62% /boot
/dev/sdb1               524030980 387134416 136896564  74% /data
tmpfs                      388076         0    388076   0% /run/user/0

# Display current disk space and usage in a more readable way
[root@backup-server ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   16G  2.3G   14G  15% /
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G     0  1.9G   0% /dev/shm
tmpfs                    1.9G  8.8M  1.9G   1% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda1                197M  121M   76M  62% /boot
/dev/sdb1                500G  370G  131G  74% /data
tmpfs                    379M     0  379M   0% /run/user/0

# View inode
[root@backup-server ~]# df -ih
Filesystem              Inodes IUsed IFree IUse% Mounted on
/dev/mapper/centos-root   8.0M   79K  7.9M    1% /
devtmpfs                  471K   351  471K    1% /dev
tmpfs                     474K     1  474K    1% /dev/shm
tmpfs                     474K   510  474K    1% /run
tmpfs                     474K    16  474K    1% /sys/fs/cgroup
/dev/sda1                 100K   328  100K    1% /boot
/dev/sdb1                 250M   119  250M    1% /data
tmpfs                     474K     1  474K    1% /run/user/0

# View file system disk footprint
[root@backup-server ~]# df -Th
Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root xfs        16G  2.3G   14G  15% /
devtmpfs                devtmpfs  1.9G     0  1.9G   0% /dev
tmpfs                   tmpfs     1.9G     0  1.9G   0% /dev/shm
tmpfs                   tmpfs     1.9G  8.8M  1.9G   1% /run
tmpfs                   tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda1               xfs       197M  121M   76M  62% /boot
/dev/sdb1               xfs       500G  370G  131G  74% /data
tmpfs                   tmpfs     379M     0  379M   0% /run/user/0

Explain:

  • Filesystem: indicates which partition the filesystem is located in, so this column displays the device name;
  • Used: indicates the amount of used disk space;
  • Available: indicates the remaining disk space;
  • Use%: disk space utilization;
  • Mounted on: the mount point of the file system, which is the directory location of the disk mount

Tags: Linux CentOS

Posted on Thu, 30 Jan 2020 08:08:22 -0800 by matt86