Linux df命令详解
df命令的功能是用来检查linux服务器的文件系统的磁盘空间占用情况。
df常见命令参数
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | -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) |
常用的命令展示:
显示所有磁盘空间占用情况
1 | df -ha 【-a 显示所有】 |
注意: tmpfs 是一个不存在于实体硬盘上、而是驻在记忆里的特殊文件系统。其中一个副作用就是当你失去电源(或重就开机)时,tmpfs 上的一切内容都会消失。tmpfs 驻守在内存里,它的速度极快。它的寻觅时间与驻守在硬盘上的一般文件系统根本不能相比。
mount -t tmpfs tempfilesystem /mnt/tmpfs 【手动挂载tmpfs文件系统】
以inode模式显示磁盘使用情况
1 | [root@localhost omc] # df -i |
显示指定类型磁盘
1 | [root@localhost omc] # df -ht ext4 |
列出文件系统的类型【常用】
1 | [root@localhost omc] # df -h |
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 为什么说在企业级应用开发中,后端往往是效率杀手?
· 用 C# 插值字符串处理器写一个 sscanf
· Java 中堆内存和栈内存上的数据分布和特点
· 开发中对象命名的一点思考
· .NET Core内存结构体系(Windows环境)底层原理浅谈
· 为什么说在企业级应用开发中,后端往往是效率杀手?
· DeepSeek 解答了困扰我五年的技术问题。时代确实变了!
· 本地部署DeepSeek后,没有好看的交互界面怎么行!
· 趁着过年的时候手搓了一个低代码框架
· 推荐一个DeepSeek 大模型的免费 API 项目!兼容OpenAI接口!