linux命令_df

  • linux命令_df已关闭评论
  • 196 次浏览
  • A+
所属分类:linux技术
摘要

linux命令学习_lllinux命令学习_piplinux命令学习_catdf命令:显示磁盘的相关信息语法:df [-ahHiklmPT][–block-size=<区块大小>][-t <文件系统类型>][-x <文件系统类型>][–help][–no-sync][–sync][–version][文件或设备]


df命令

linux命令学习_ll

linux命令学习_pip

linux命令学习_cat

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 
一般命令解释

linux命令_df

第一列代表 文件系统对应的设备文件的路径名(一般是硬件上的分区)

第二列代表 分区包含的数据块(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 包含全部的文件系统

    linux命令_df

  • --block-size=<区块大小> 以指定的区块大小来显示区块数目

    linux命令_df

  • -h或--human-readable 以可读性较高的方式来显示信息。

    linux命令_df

  • -H或--si 与-h参数相同,但在计算时是以1000 Bytes为换算单位而非1024 Bytes。

    linux命令_df

  • -i或--inodes 显示inode的信息。

    linux命令_df

  • --no-sync 在取得磁盘使用信息前,不要执行sync指令,此为预设值。

    linux命令_df

    Sync用于强制将改变的内容立刻写入磁盘

    注意事项:

    用户通常不用运行sync命令,系统会自动运行,update或bdflush操作将缓冲区数据写入到磁盘中。只有当update或bdflush无法执行或用户需要非正常关机时,此时需手动执行sync命令

  • df -BM/df -h/df -H/df -k:只是显示的数据块的单位不同

  • df -T/df -t/df -x: 是打印指定文件系统类型的磁盘使用情况