df命令的功能是用来检查linux服务器的文件系统的磁盘空间占用情况。
df常见命令参数
-a, --all include dummy file systems
-B, --block-size=SIZE use SIZE-byte blocks
--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)
-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)
常用的命令展示:
显示所有磁盘空间占用情况
df -ha 【-a 显示所有】
注意: tmpfs 是一个不存在于实体硬盘上、而是驻在记忆里的特殊文件系统。其中一个副作用就是当你失去电源(或重就开机)时,tmpfs 上的一切内容都会消失。tmpfs 驻守在内存里,它的速度极快。它的寻觅时间与驻守在硬盘上的一般文件系统根本不能相比。
mount -t tmpfs tempfilesystem /mnt/tmpfs 【手动挂载tmpfs文件系统】
以inode模式显示磁盘使用情况
[root@localhost omc]# df -i
显示指定类型磁盘
[root@localhost omc]# df -ht ext4
列出文件系统的类型【常用】
[root@localhost omc]# df -h