df
瑞兹 发表于 2021-01-11 09:21浏览次数:
在类似Unix的操作系统上,df命令报告文件系统正在使用的可用磁盘空间量。
On Unix-like operating systems, the df command reports the amount of available disk space being used by file systems.
目录:
1 df 运行系统环境
2 df 描述
3 df 语法
4 df 例子
df 运行系统环境
df 描述
df显示包含每个文件名参数的文件系统上可用的磁盘空间量。如果未提供文件名,则会显示所有当前已安装文件系统上的可用空间。默认情况下,磁盘空间以1 K块显示,除非设置了环境变量 POSIXLY_CORRECT,在这种情况下使用512字节 块。
如果参数是包含已安装文件系统的磁盘设备节点的绝对文件名,则df将显示该文件系统上的可用空间,而不是包含设备节点的文件系统上的可用空间(该文件系统始终是根文件系统)。df无法显示未挂载文件系统上的可用空间,因为在大多数类型的系统上,这样做需要非常特定于系统的文件系统结构知识。
df displays the amount of disk space available on the file system containing each file name argument. If no file name is given, the space available on all currently mounted file systems is shown. Disk space is shown in 1 K blocks by default, unless the environment variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.
If an argument is the absolute file name of a disk device node containing a mounted file system, df shows the space available on that file system rather than on the file system containing the device node (which is always the root file system). df cannot show the space available on unmounted file systems, because on most kinds of systems doing so requires very system-specific knowledge of file system structures.
df 语法
df [OPTION]... [FILE]...
选件
-a,--all
|
包括虚拟文件系统。
|
-B,-- block-size =SIZE
|
在打印之前按SIZE缩放尺寸。例如,“ -BM ”以1,048,576字节为单位打印大小。有关更多信息,请参见下面的“ SIZE格式”。
|
--total
|
显示总计。
|
-h,--human-readable
|
以人类可读的格式打印尺寸(例如1K 234M 2G)。
|
-H,-- si
|
与-h相同,但是使用1000的幂而不是1024。
|
-i,-- inodes
|
列出索引节点信息而不是块用法。
|
-k
|
像--block-size = 1K。
|
-l,-- local
|
将列表限制为本地文件系统。
|
--no-sync
|
获取使用信息(默认设置)之前,请勿调用同步。
|
-P,--portability
|
使用POSIX输出格式。
|
--sync
|
在获取使用情况信息之前调用同步。
|
-t,-- type =TYPE
|
将列表限制为TYPE类型的文件系统。
|
-T,-- print-type
|
打印文件系统类型。
|
-x,-- exclude-type =TYPE
|
将列表限制为非TYPE类型的文件系统。
|
-v
|
被忽略;出于兼容性原因而包含在内。
|
--help
|
显示帮助消息并退出。
|
--version
|
输出版本信息并退出。
|
SIZE格式
显示值以--block-size中第一个可用的SIZE以及DF_BLOCK_SIZE,BLOCK_SIZE和BLOCKSIZE环境变量为单位。否则,单位默认为1024字节(如果设置了POSIXLY_CORRECT,则为512字节)。
SIZE是整数和可选单位(例如:10M是10 * 1024 * 1024)。单位为K,M,G,T,P,E,Z,Y(1024的幂)或KB,MB,...(1000的幂)。
df [OPTION]... [FILE]...
Options
-a, --all
|
Include dummy file systems.
|
-B, --block-size=SIZE
|
Scale sizes by SIZE before printing them. E.g., '-BM' prints sizes in units of 1,048,576 bytes. See "SIZE Format" below for more information.
|
--total
|
Display a grand total.
|
-h, --human-readable
|
Print sizes in human readable format (e.g., 1K 234M 2G).
|
-H, --si
|
Same as -h, but use powers of 1000 instead of 1024.
|
-i, --inodes
|
List inode information instead of block usage.
|
-k
|
Like --block-size=1K.
|
-l, --local
|
Limit listing to local file systems.
|
--no-sync
|
Do not invoke a sync before getting usage info, which is the default setting.
|
-P, --portability
|
Use the POSIX output format.
|
--sync
|
Invoke a sync before getting usage info.
|
-t, --type=TYPE
|
Limit listing to file systems of type TYPE.
|
-T, --print-type
|
Print file system type.
|
-x, --exclude-type=TYPE
|
Limit listing to file systems not of type TYPE.
|
-v
|
Ignored; included for compatibility reasons.
|
--help
|
Display a help message and exit.
|
--version
|
Output version information and exit.
|
SIZE Format
Display values are in units of the first available SIZE from --block-size, and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables. Otherwise, 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 (powers of 1024) or KB, MB, ... (powers of 1000).
df 例子
df
显示所有文件系统及其磁盘使用情况,如以下输出所示:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/loop0 18761008 15246876 2554440 86% /
none 4 0 4 0% /sys/fs/cgroup
udev 493812 4 493808 1% /dev
tmpfs 100672 1364 99308 2% /run
none 5120 0 5120 0% /run/lock
none 503352 1764 501588 1% /run/shm
none 102400 20 102380 1% /run/user
/dev/sda3 174766076 164417964 10348112 95% /host
df -h
与上述相同,但使用“人类可读”格式,如以下示例所示:
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 18G 15G 2.5G 86% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 483M 4.0K 483M 1% /dev
tmpfs 99M 1.4M 97M 2% /run
none 5.0M 0 5.0M 0% /run/lock
none 492M 1.8M 490M 1% /run/shm
none 100M 20K 100M 1% /run/user
/dev/sda3 167G 157G 9.9G 95% /host
df public_html
在public_html目录中显示可用空间量,如以下输出所示:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/loop0 18761008 15246924 2554392 86% /
df
Display all file systems and their disk usage, as in the following output:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/loop0 18761008 15246876 2554440 86% /
none 4 0 4 0% /sys/fs/cgroup
udev 493812 4 493808 1% /dev
tmpfs 100672 1364 99308 2% /run
none 5120 0 5120 0% /run/lock
none 503352 1764 501588 1% /run/shm
none 102400 20 102380 1% /run/user
/dev/sda3 174766076 164417964 10348112 95% /host
df -h
Same as above, but use "human readable" formatting, as in the following example:
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 18G 15G 2.5G 86% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 483M 4.0K 483M 1% /dev
tmpfs 99M 1.4M 97M 2% /run
none 5.0M 0 5.0M 0% /run/lock
none 492M 1.8M 490M 1% /run/shm
none 100M 20K 100M 1% /run/user
/dev/sda3 167G 157G 9.9G 95% /host
df public_html
Display the amount of free space in the public_html directory, as in the following output:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/loop0 18761008 15246924 2554392 86% /
未知的网友