df [OPTION]... [FILE]...
!subtitle:功能
查看文件系统的空间占用。
!subtitle:类型
可执行文件(/usr/bin/df),属于 coreutils。
!subtitle:参数
OPTION 选项:
-a, --all - 包括伪文件系统、重复的文件系统以及无法访问的文件系统
-B, --block-size=SIZE - 指定单位,例如 -B 4K 表示以 4096 字节为单位
-h, --human-readable - 自动添加单位以便人类阅读,1K 表示 1024 字节
-H, --si - 自动添加单位以便人类阅读,1K 表示 1000 字节
-i, --inodes - 列出 inode 信息而不是块占用
-k - 等价于 -B 1K
-l, --local - 范围限制在本地文件系统
--no-sync - 不在获取占用信息前调用 sync(默认)
--output[=FIELD_LIST] - 使用 FIELD_LIST 指定的输出格式;有效值:
source - 文件系统源路径
fstype - 文件系统类型
itotal - inode 总数
iused - inode 占用数
iavail - inode 可用数
ipcent - inode 占用百分比
size - 总空间
used - 占用空间
avail - 可用空间
pcent - 空间占用百分比
file - 文件路径(对应参数中的 FILE)
target - 挂载路径
-P, --portability - 使用 POSIX 输出格式
--sync - 在获取占用信息前自动调用 sync
--total - 忽略对可用空间影响不大的条目并得出总计数据
-t, --type=TYPE - 范围限制在 TYPE 指定的文件系统类型
-T, --print-type - 打印文件系统类型
-x, --exclude-type=TYPE - 忽略 TYPE 指定的文件系统类型
--help - 显示帮助
--version - 显示版本
FILE - 文件列表;默认查看所有文件系统
!subtitle:基本使用
$ df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 1.4G 1.7M 1.4G 1% /run
efivarfs 128K 13K 111K 10% /sys/firmware/efi/efivars
/dev/nvme0n1p2 915G 172G 697G 20% /
tmpfs 6.8G 0 6.8G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/nvme0n1p1 1.1G 6.2M 1.1G 1% /boot/efi
tmpfs 1.4G 16K 1.4G 1% /run/user/1000
!subtitle:指定格式
$ df -h --output=source,fstype,used,avail,size,pcent
Filesystem Type Used Avail Size Use%
tmpfs tmpfs 1.7M 1.4G 1.4G 1%
efivarfs efivarfs 13K 111K 128K 10%
/dev/nvme0n1p2 ext4 172G 697G 915G 20%
tmpfs tmpfs 0 6.8G 6.8G 0%
tmpfs tmpfs 0 5.0M 5.0M 0%
/dev/nvme0n1p1 vfat 6.2M 1.1G 1.1G 1%
tmpfs tmpfs 16K 1.4G 1.4G 1%
DF(1) User Commands DF(1)
NAME
df - report file system space usage
SYNOPSIS
df [OPTION]... [FILE]...
DESCRIPTION
This manual page documents the GNU version of df. df displays the
amount of space available on the file system containing each file name
argument. If no file name is given, the space available on all cur‐
rently mounted file systems is shown. Space is shown in 1K 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 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. This ver‐
sion of df cannot show the space available on unmounted file systems,
because on most kinds of systems doing so requires non-portable inti‐
mate knowledge of file system structures.
OPTIONS
Show information about the file system on which each FILE resides, or
all file systems by default.
Mandatory arguments to long options are mandatory for short options
too.
-a, --all
include pseudo, duplicate, inaccessible 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
-h, --human-readable
print sizes in powers of 1024 (e.g., 1023M)
-H, --si
print sizes in powers of 1000 (e.g., 1.1G)
-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 sync before getting usage info (default)
--output[=FIELD_LIST]
use the output format defined by FIELD_LIST, or print all fields
if FIELD_LIST is omitted.
-P, --portability
use the POSIX output format
--sync invoke sync before getting usage info
--total
elide all entries insignificant to available space, and produce
a grand total
-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)
--help display this help and exit
--version
output version information and exit
Display values are in units of the first available SIZE from
--block-size, and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environ‐
ment variables. Otherwise, units default to 1024 bytes (or 512 if
POSIXLY_CORRECT is set).
The SIZE argument is an integer and optional unit (example: 10K is
10*1024). Units are K,M,G,T,P,E,Z,Y,R,Q (powers of 1024) or KB,MB,...
(powers of 1000). Binary prefixes can be used, too: KiB=K, MiB=M, and
so on.
FIELD_LIST is a comma-separated list of columns to be included. Valid
field names are: 'source', 'fstype', 'itotal', 'iused', 'iavail', 'ip‐
cent', 'size', 'used', 'avail', 'pcent', 'file' and 'target' (see info
page).
AUTHOR
Written by Torbjorn Granlund, David MacKenzie, and Paul Eggert.
REPORTING BUGS
GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Report any translation bugs to <https://translationproject.org/team/>
COPYRIGHT
Copyright © 2023 Free Software Foundation, Inc. License GPLv3+: GNU
GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
Full documentation <https://www.gnu.org/software/coreutils/df>
or available locally via: info '(coreutils) df invocation'
GNU coreutils 9.4 April 2024 DF(1)