linux命令_df
df命令
df命令:显示磁盘的相关信息
语法:df [-ahHiklmPT][--block-size=<区块大小>][-t <文件系统类型>][-x <文件系统类型>][--help][--no-sync][--sync][--version][文件或设备]
df可显示磁盘的文件系统与使用情形。
[root@localhost ~] df --help
Usage: df [OPTION]... [FILE]...
Show information about the file system on which each FILE resides,
or all file systems by default.
Mandatory arguments to long options are mandatory for short options too.
-a, --all include pseudo, duplicate, inaccessible 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
-h, --human-readable print sizes in powers of 1024 (e.g., 1023M)
-H, --si print sizes in powers of 1000 (e.g., 1.1G)
-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
--total elide all entries insignificant to available space,
and produce a grand total
-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
一般命令解释
第一列代表 文件系统对应的设备文件的路径名(一般是硬件上的分区)
第二列代表 分区包含的数据块(1024byte)的数目
第三列代表 使用的数据块的数据
第四列代表 可用的数据块的数据
第五列代表 使用的数据块的所占百分比
第六列代表 文件系统的挂载点。
参数命令 | 用途 |
---|---|
df -i | 输出文件系统的 inode 信息,如果iNode满了,即使有空间也不能存储 |
df -h | 以人类易读的格式输出 |
df -a | 显示所有文件系统的磁盘使用情况 |
df -h /boot | 显示特定文件系统已使用的空间 |
df -T | 输出所有已挂载文件系统的类型 |
df -k | 按块大小输出文件系统磁盘使用情况 |
df -i /boot | 特定文件系统的 inode 信息 |
df -h --total | 输出所有文件系统使用情况汇总 |
df -hT | 只打印本地文件系统磁盘的使用情况df |
df -hTl | 只打印本地文件系统 |
df -t ifs | 打印特定文件系统类型的磁盘使用情况 |
df -x nfs4 | 查看nfs文件系统信息 |
df -x xfs | 使用 -x 选项排除特定的文件系统类型 |
df --output=fstype,size,iused | 在 df 命令的输出中只打印特定的字段 |
举例:
-
-a或--all 包含全部的文件系统
-
--block-size=<区块大小> 以指定的区块大小来显示区块数目
-
-h或--human-readable 以可读性较高的方式来显示信息。
-
-H或--si 与-h参数相同,但在计算时是以1000 Bytes为换算单位而非1024 Bytes。
-
-i或--inodes 显示inode的信息。
-
--no-sync 在取得磁盘使用信息前,不要执行sync指令,此为预设值。
Sync用于强制将改变的内容立刻写入磁盘
注意事项:
用户通常不用运行sync命令,系统会自动运行,update或bdflush操作将缓冲区数据写入到磁盘中。只有当update或bdflush无法执行或用户需要非正常关机时,此时需手动执行sync命令
-
df -BM/df -h/df -H/df -k:只是显示的数据块的单位不同
-
df -T/df -t/df -x: 是打印指定文件系统类型的磁盘使用情况
本文来自博客园,作者:ivanlee717,转载请注明原文链接:https://www.cnblogs.com/ivanlee717/p/16273250.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET10 - 预览版1新功能体验(一)