linux中的df命令的功能:报告文件系统正在使用的可用磁盘空间量
描述:
df显示包含每个文件名参数的文件系统上可用的磁盘空间量。如果未给出文件名,则会显示所有当前安装的文件系统上可用的空间。磁盘空间默认显示为1 K块,除非设置了环境变量POSIXLY_CORRECT,在这种情况下使用512字节的块。
如果参数是包含已装入文件系统的磁盘设备节点的绝对文件名,则df将显示该文件系统上可用的空间,而不是包含设备节点(始终是根文件系统)的文件系统上的可用空间。 df无法显示未安装的文件系统上可用的空间,因为在大多数系统上这样做需要系统特定的文件系统结构知识。
语法:
df [OPTION] ... [FILE]
选项:
-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格式:
显示值以--block-size和DF_BLOCK_SIZE,BLOCK_SIZE和BLOCKSIZE环境变量中的第一个可用SIZE为单位。否则,单位默认为1024字节(如果设置POSIXLY_CORRECT,则为512)。 SIZE是一个整数和可选单位(例如:10M是10 * 1024 * 1024)。单位是K,M,G,T,P,E,Z,Y(1024的幂)或KB,MB,...(1000的幂)。
df 例子:
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% /