Common Linux commands - df command

Online Linux command query tool

df

Display disk related information

Additional information

The 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

-a或--all:包含全部的文件系统;
--block-size=<区块大小>:以指定的区块大小来显示区块数目;
-h或--human-readable:以可读性较高的方式来显示信息;
-H或--si:与-h参数相同,但在计算时是以1000 Bytes为换算单位而非1024 Bytes;
-i或--inodes:显示inode的信息;
-k或--kilobytes:指定区块大小为1024字节;
-l或--local:仅显示本地端的文件系统;
-m或--megabytes:指定区块大小为1048576字节;
--no-sync:在取得磁盘使用信息前,不要执行sync指令,此为预设值;
-P或--portability:使用POSIX的输出格式;
--sync:在取得磁盘使用信息前,先执行sync指令;
-t<文件系统类型>或--type=<文件系统类型>:仅显示指定文件系统类型的磁盘信息;
-T或--print-type:显示文件系统的类型;
-x<文件系统类型>或--exclude-type=<文件系统类型>:不要显示指定文件系统类型的磁盘信息;
--help:显示帮助;
--version:显示版本信息。

parameter

File: Specifies a file on the file system.

size format

Displayed values ​​are in units of --block-sizesum DF_BLOCK_SIZE, BLOCK_SIZEand BLOCKSIZEthe first available in the environment variable SIZE. Otherwise, units default to 1024bytes (if set POSIXLY_CORRECT) 512.
SIZE is an integer and optional unit (example: 10M is 10 * 1024 * 1024). The 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
文件系统               1K-块        已用     可用 已用% 挂载点
/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 -hoptions to display units above KB for high readability:

[root@LinServ-1 ~]# df -h
文件系统              容量  已用 可用 已用% 挂载点
/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
文件系统               1K-块        已用     可用 已用% 挂载点
/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 publicthe amount of free space in the 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

Online Linux command query tool

Online Linux command query tool

Guess you like

Origin blog.csdn.net/weixin_43251547/article/details/128597882