【Linux】df 朴灿烈づ我的快乐病毒、 2022-02-23 06:44 146阅读 0赞 > df(disk filesystem)命令用来获取磁盘文件系统的整体使用情况 [root@localhost /]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/centos-root 38770180 6426280 32343900 17% / devtmpfs 486272 0 486272 0% /dev tmpfs 503460 0 503460 0% /dev/shm tmpfs 503460 8336 495124 2% /run tmpfs 503460 0 503460 0% /sys/fs/cgroup /dev/sda1 1038336 161912 876424 16% /boot tmpfs 100696 12 100684 1% /run/user/42 tmpfs 100696 0 100696 0% /run/user/0 [root@localhost /]# 通过上面的输出,我们可以了解到对应的文件系统、总的block块数量、已使用空间、可用空间以及对应的挂载点. `df`可以接受路径参数,主要是通过该路径所在的文件系统,来了解对应文件系统的磁盘使用情况. [root@localhost /]# df -h /home/jiangjian/jenkins-2.164.1-1.1.noarch.rpm Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 37G 6.2G 31G 17% / [root@localhost /]# 下面来了解常用的选型: `-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 486272 0 486272 0% /dev securityfs 0 0 0 - /sys/kernel/security tmpfs 503460 0 503460 0% /dev/shm devpts 0 0 0 - /dev/pts tmpfs 503460 8336 495124 2% /run tmpfs 503460 0 503460 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/cpu,cpuacct cgroup 0 0 0 - /sys/fs/cgroup/pids cgroup 0 0 0 - /sys/fs/cgroup/net_cls,net_prio cgroup 0 0 0 - /sys/fs/cgroup/memory cgroup 0 0 0 - /sys/fs/cgroup/devices cgroup 0 0 0 - /sys/fs/cgroup/cpuset cgroup 0 0 0 - /sys/fs/cgroup/perf_event cgroup 0 0 0 - /sys/fs/cgroup/blkio cgroup 0 0 0 - /sys/fs/cgroup/hugetlb cgroup 0 0 0 - /sys/fs/cgroup/freezer configfs 0 0 0 - /sys/kernel/config /dev/mapper/centos-root 38770180 6426504 32343676 17% / selinuxfs 0 0 0 - /sys/fs/selinux systemd-1 - - - - /proc/sys/fs/binfmt_misc debugfs 0 0 0 - /sys/kernel/debug hugetlbfs 0 0 0 - /dev/hugepages mqueue 0 0 0 - /dev/mqueue /dev/sda1 1038336 161912 876424 16% /boot sunrpc 0 0 0 - /var/lib/nfs/rpc_pipefs tmpfs 100696 12 100684 1% /run/user/42 binfmt_misc 0 0 0 - /proc/sys/fs/binfmt_misc tmpfs 100696 0 100696 0% /run/user/0 [root@localhost /]# `-h`:控制大小的显示为易读的方式 [root@localhost /]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 37G 6.2G 31G 17% / devtmpfs 475M 0 475M 0% /dev tmpfs 492M 0 492M 0% /dev/shm tmpfs 492M 8.2M 484M 2% /run tmpfs 492M 0 492M 0% /sys/fs/cgroup /dev/sda1 1014M 159M 856M 16% /boot tmpfs 99M 12K 99M 1% /run/user/42 tmpfs 99M 0 99M 0% /run/user/0 [root@localhost /]# `-T`:显示对应文件系统的类型 [root@localhost /]# df -hT Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/centos-root xfs 37G 6.2G 31G 17% / devtmpfs devtmpfs 475M 0 475M 0% /dev tmpfs tmpfs 492M 0 492M 0% /dev/shm tmpfs tmpfs 492M 8.2M 484M 2% /run tmpfs tmpfs 492M 0 492M 0% /sys/fs/cgroup /dev/sda1 xfs 1014M 159M 856M 16% /boot tmpfs tmpfs 99M 12K 99M 1% /run/user/42 tmpfs tmpfs 99M 0 99M 0% /run/user/0 [root@localhost /]# `-h`:控制输出的磁盘大小单位为:K [root@localhost /]# df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/centos-root 38770180 6426736 32343444 17% / devtmpfs 486272 0 486272 0% /dev tmpfs 503460 0 503460 0% /dev/shm tmpfs 503460 8336 495124 2% /run tmpfs 503460 0 503460 0% /sys/fs/cgroup /dev/sda1 1038336 161912 876424 16% /boot tmpfs 100696 12 100684 1% /run/user/42 tmpfs 100696 0 100696 0% /run/user/0 [root@localhost /]# `-m`:控制输出的磁盘大小单位为:M [root@localhost /]# df -m Filesystem 1M-blocks Used Available Use% Mounted on /dev/mapper/centos-root 37862 6277 31586 17% / devtmpfs 475 0 475 0% /dev tmpfs 492 0 492 0% /dev/shm tmpfs 492 9 484 2% /run tmpfs 492 0 492 0% /sys/fs/cgroup /dev/sda1 1014 159 856 16% /boot tmpfs 99 1 99 1% /run/user/42 tmpfs 99 0 99 0% /run/user/0 [root@localhost /]# `-i`:控制输出的磁盘大小单位为:inode [root@localhost /]# df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/mapper/centos-root 19394560 179427 19215133 1% / devtmpfs 121568 397 121171 1% /dev tmpfs 125865 1 125864 1% /dev/shm tmpfs 125865 844 125021 1% /run tmpfs 125865 16 125849 1% /sys/fs/cgroup /dev/sda1 524288 370 523918 1% /boot tmpfs 125865 9 125856 1% /run/user/42 tmpfs 125865 1 125864 1% /run/user/0 [root@localhost /]# `-t`:控制输出符合给定类型的文件系统 [root@localhost /]# df -T Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/mapper/centos-root xfs 38770180 6426292 32343888 17% / devtmpfs devtmpfs 486272 0 486272 0% /dev tmpfs tmpfs 503460 0 503460 0% /dev/shm tmpfs tmpfs 503460 8336 495124 2% /run tmpfs tmpfs 503460 0 503460 0% /sys/fs/cgroup /dev/sda1 xfs 1038336 161912 876424 16% /boot tmpfs tmpfs 100696 12 100684 1% /run/user/42 tmpfs tmpfs 100696 0 100696 0% /run/user/0 [root@localhost /]# df -T -x xfs Filesystem Type 1K-blocks Used Available Use% Mounted on devtmpfs devtmpfs 486272 0 486272 0% /dev tmpfs tmpfs 503460 0 503460 0% /dev/shm tmpfs tmpfs 503460 8336 495124 2% /run tmpfs tmpfs 503460 0 503460 0% /sys/fs/cgroup tmpfs tmpfs 100696 12 100684 1% /run/user/42 tmpfs tmpfs 100696 0 100696 0% /run/user/0 [root@localhost /]# `-x`:剔除符合给定类型的文件系统 [root@localhost /]# df -x ext3 Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/centos-root 38770180 6426736 32343444 17% / devtmpfs 486272 0 486272 0% /dev tmpfs 503460 0 503460 0% /dev/shm tmpfs 503460 8336 495124 2% /run tmpfs 503460 0 503460 0% /sys/fs/cgroup /dev/sda1 1038336 161912 876424 16% /boot tmpfs 100696 12 100684 1% /run/user/42 tmpfs 100696 0 100696 0% /run/user/0 [root@localhost /]#
还没有评论,来说两句吧...