linux df命令详解
栏目:
Linux
发布时间:2022-02-23
df,英文全称为 “disk full”,从字面意义不难理解,该命令用于查看系统的整体磁盘使用情况。
df 命令语法
df [-ahikHTm] [目录或文件名]
选项与参数:
-a :列出所有的文件系统,包括系统特有的 /proc 等文件系统
-k :以 KBytes 的容量显示各文件系统
-m :以 MBytes 的容量显示各文件系统
-h :以人们较易阅读的 GBytes, MBytes, KBytes 等格式自行显示
-H :以 M=1000K 取代 M=1024K 的进位方式
-T :显示文件系统类型, 连同该 partition 的 filesystem 名称 (例如 ext3) 也列出
-i :不用硬盘容量,而以 inode 的数量来显示
df 实例
1、使用 df 命令将系统内所有的文件系统列出来
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 989496 0 989496 0% /dev
tmpfs 203544 1012 202532 1% /run
/dev/vda1 41152812 15869612 23379544 41% /
tmpfs 1017720 0 1017720 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 1017720 0 1017720 0% /sys/fs/cgroup
tmpfs 203544 0 203544 0% /run/user/0
overlay 41152812 15869612 23379544 41% /var/lib/docker/overlay2/7712a9c6e25a7cb60a57117c4eef5c558d75830e1e9bd265d542b02284cce5dc/merged
overlay 41152812 15869612 23379544 41% /var/lib/docker/overlay2/54cc20ebfb0784fe7c171110f73167c84d8afdddafc74dc9a329a94c6f691f33/merged
shm 65536 0 65536 0% /var/lib/docker/containers/5b7778a04ab458bf003ae5167d7dd6b4efad8185415f0dceff84364267951917/mounts/shm
shm 65536 0 65536 0% /var/lib/docker/containers/294af34c31ac41b41e0f8072177c771d58c70e3e49ead390ea4623a6162a820f/mounts/shm
overlay 41152812 15869612 23379544 41% /var/lib/docker/overlay2/2467f5d41e7f7889be3dca9054d784510bb59e67fc7fb8c9f51fe06d1f3bde89/merged
shm 65536 0 65536 0% /var/lib/docker/containers/6bacee1550c9e0ba5c5de0e2f20b4c72d1c96d1e51878c7c366e856467d826c3/mounts/shm
overlay 41152812 15869612 23379544 41% /var/lib/docker/overlay2/9b1b902c91289db906e1a2def9857990df8d43cf7a26c20bfd4db27b1fe81658/merged
shm 65536 0 65536 0% /var/lib/docker/containers/e5b4dd2942d516fe97d030ccc05c91795d279fd04fd45e682a279cac775bc2a8/mounts/shm
2、使用 df -h 让结果更易读
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 967M 0 967M 0% /dev
tmpfs 199M 1012K 198M 1% /run
/dev/vda1 40G 16G 23G 41% /
tmpfs 994M 0 994M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 994M 0 994M 0% /sys/fs/cgroup
tmpfs 199M 0 199M 0% /run/user/0
overlay 40G 16G 23G 41% /var/lib/docker/overlay2/7712a9c6e25a7cb60a57117c4eef5c558d75830e1e9bd265d542b02284cce5dc/merged
overlay 40G 16G 23G 41% /var/lib/docker/overlay2/54cc20ebfb0784fe7c171110f73167c84d8afdddafc74dc9a329a94c6f691f33/merged
shm 64M 0 64M 0% /var/lib/docker/containers/5b7778a04ab458bf003ae5167d7dd6b4efad8185415f0dceff84364267951917/mounts/shm
shm 64M 0 64M 0% /var/lib/docker/containers/294af34c31ac41b41e0f8072177c771d58c70e3e49ead390ea4623a6162a820f/mounts/shm
overlay 40G 16G 23G 41% /var/lib/docker/overlay2/2467f5d41e7f7889be3dca9054d784510bb59e67fc7fb8c9f51fe06d1f3bde89/merged
shm 64M 0 64M 0% /var/lib/docker/containers/6bacee1550c9e0ba5c5de0e2f20b4c72d1c96d1e51878c7c366e856467d826c3/mounts/shm
overlay 40G 16G 23G 41% /var/lib/docker/overlay2/9b1b902c91289db906e1a2def9857990df8d43cf7a26c20bfd4db27b1fe81658/merged
shm 64M 0 64M 0% /var/lib/docker/containers/e5b4dd2942d516fe97d030ccc05c91795d279fd04fd45e682a279cac775bc2a8/mounts/shm
3、将 /dev 底下的磁盘容量使用情况以易读的方式展示出来
$ df -h /dev
Filesystem Size Used Avail Use% Mounted on
udev 967M 0 967M 0% /dev
本文地址:https://www.tides.cn/p_linux-df