目录 df的使用
- 功能
- 格式
- 选项
- 实例
- df 输出参数
- df -a 显示所有的文件
- df -h 方便阅读方式显示 (1K=1000,而不是1K=1024)
1.功能
可以接受路径参数,主要是通过该路径所在的文件系统,来了解对应文件系统的磁盘使用情况.
2.格式
Usage: df [OPTION]... [FILE]...
df [选项]...[文件]
3.选项
-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 --direct show statistics for a file instead of mount point --total produce a grand total -h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G) -H, --si likewise, but use powers of 1000 not 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 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 -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 -h:控制大小的显示为易读的方式 -k控制输出的磁盘大小单位为:K
4.实例
4.1 df展示
[root@localhost ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/vda1 41151808 1797652 37240724 5% / devtmpfs 239068 0 239068 0% /dev tmpfs 249664 0 249664 0% /dev/shm tmpfs 249664 436 249228 1% /run tmpfs 249664 0 249664 0% /sys/fs/cgroup tmpfs 49936 0 49936 0% /run/user/0
输出参数
- Filesystem //文件系统的名称
- 1K-blocks // blocks个数
- used // 使用的容量
- Available //可用的容量
- use% //用了多少的百分比
- Mounted on //挂载点
4.2 -a 显示所有文件
[root@ localhost ~]# df -a Filesystem 1K-blocks Used Available Use% Mounted on rootfs - - - - / sysfs 0 0 0 - /sys proc 0 0 0 - /proc devtmpfs 488988 0 488988 0% /dev securityfs 0 0 0 - /sys/kernel/security tmpfs 499968 0 499968 0% /dev/shm devpts 0 0 0 - /dev/pts tmpfs 499968 6804 493164 2% /run tmpfs 499968 0 499968 0% /sys/fs/cgroup cgroup 0 0 0 - /sys/fs/cgroup/systemd pstore 0 0 0 - /sys/fs/pstore cgroup 0 0 0 - /sys/fs/cgroup/freezer cgroup 0 0 0 - /sys/fs/cgroup/net_cls,net_prio cgroup 0 0 0 - /sys/fs/cgroup/pids cgroup 0 0 0 - /sy
4.3 -h 方便阅读方式显示 (1K=1000,而不是1K=1024)
[root@ localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/cl-root 17G 1.9G 16G 11% / devtmpfs 478M 0 478M 0% /dev tmpfs 489M 0 489M 0% /dev/shm tmpfs 489M 6.7M 482M 2% /run tmpfs 489M 0 489M 0% /sys/fs/cgroup /dev/sda1 1014M 121M 894M 12% /boot tmpfs 98M 0 98M 0% /run/user/0