声明:
本文可转载,但请声明出处。联系方式: jinguang.liu@qq.com
命令描述
df命令用于查看文件系统磁盘空间使用情况,本文在Centos6.5上对df命令进行了测试,相关的版本信息为:
[root@centos ~]# uname -r
3.10.29-11.el6.centos.alt.x86_64
[root@centos ~]# df --version
df (GNU coreutils) 8.4
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://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.
Written by Torbjorn Granlund, David MacKenzie, and Paul Eggert.
命令语法规则如下:df [OPTION]... [FILE]...
使用解析及实例
如果df命令不带任何参数,它将显示所有当前已经挂载各类文件系统的使用情况信息。否则,它显示指定的文件参数所在文件系统的使用情况。文件系统使用空间信息单 位为1024字节,当然,也可以指定具体的空间单位参数信息(-B, --block-size=SIZE)。[root@centos ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_centos-LogVol01 241768872 9584640 219880056 5% /
tmpfs 472932 292 472640 1% /dev/shm
/dev/sda1 245679 85272 143204 38% /boot
xenstore 472932 88 472844 1% /var/lib/xenstored
[root@centos ~]# df /root/hs_err_pid2553.log
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_centos-LogVol01 241768872 9584620 219880076 5% /
常用参数选项
-a, --all 包含所有文件系统类型
-B, --block-size=SIZE 指定块大小,单位字节
-h, --human-readable 以更加易读的方式显示使用情况信息,如1K, 234M, 2G
-H, --si 以1000字节为单位而非1024字节计算文件系统的使用情况
-i, --inodes 显示inode信息
-k 等同与--block-size=1K
-l, --local 仅显示本地文件系统信息
--no-sync 获取使用信息前不调用sync,缺省行为
--sync 获取使用信息前调用sync
-t, --type=TYPE 指定显示文件系统的类型,非该类型的文件系统不显示
-T, --print-type 显示文件系统的类型
-x, --exclude-type=TYPE 限定不显示指定类型的文件系统的使用信息
--help 显示帮助信息
--version 显示版本信息
下列显示了一些使用的例子:
[root@centos ~]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/vg_centos-LogVol01 15360000 119514 15240486 1% /
tmpfs 118233 6 118227 1% /dev/shm
/dev/sda1 65536 53 65483 1% /boot
xenstore 118233 2 118231 1% /var/lib/xenstored
[root@centos ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_centos-LogVol01 231G 9.2G 210G 5% /
tmpfs 462M 292K 462M 1% /dev/shm
/dev/sda1 240M 84M 140M 38% /boot
xenstore 462M 88K 462M 1% /var/lib/xenstored
[root@centos ~]# df -hH
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_centos-LogVol01 248G 9.9G 226G 5% /
tmpfs 485M 300k 484M 1% /dev/shm
/dev/sda1 252M 88M 147M 38% /boot
xenstore 485M 91k 485M 1% /var/lib/xenstored
[root@centos ~]# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_centos-LogVol01 ext4 241768872 9584788 219879908 5% /
tmpfs tmpfs 472932 292 472640 1% /dev/shm
/dev/sda1 ext4 245679 85272 143204 38% /boot
xenstore tmpfs 472932 88 472844 1% /var/lib/xenstored
需要了解更详细的信息,请参看info df帮助信息。