博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
df 命令查看磁盘空间_Linux df命令检查磁盘空间
阅读量:2532 次
发布时间:2019-05-11

本文共 3460 字,大约阅读时间需要 11 分钟。

df 命令查看磁盘空间

Periodically, you may need to monitor or check the disk space on your system to ensure that you have enough space to install software packages or save files. There are plenty of tools on the internet for checking disk space. Linux comes with its own built-in utility called df for checking the amount of disk space on your system. In this article, we look at how you can check disk space in Linux using the df command.

您可能需要定期监视或检查系统上的磁盘空间,以确保您有足够的空间来安装软件包或保存文件。 互联网上有很多用于检查磁盘空间的工具。 Linux带有自己的内置实用程序df用于检查系统上的磁盘空间量。 在本文中,我们介绍了如何使用df命令在Linux中检查磁盘空间。

使用Linux df命令检查磁盘空间 (Check disk space using Linux df command)

The df command without any options displays total blocks, used space, available disk space and mount points located on the filesystem.

不带任何选项的df命令将显示总块数,已用空间,可用磁盘空间和文件系统上的安装点。

$ df

Sample output

Check Disk Space In Linux Df Command

样品输出

检查所有文件系统的磁盘空间 (Check disk space of all filesystems)

To display disk space of all file systems, use the -a option as shown. Apart from displaying the conventional filesystems, the -a option displays dummy filesystems:

要显示所有文件系统的磁盘空间,请使用-a选项,如图所示。 除了显示常规文件系统之外, -a选项还显示虚拟文件系统:

$ df -a

Sample output

样品输出

以可读格式检查磁盘空间 (Check disk space in human readable format)

AS previously seen df command displays information in bytes, which is not exactly easy to read format. You can display disk space in a human-readable format using the following options.

如先前所见, df命令以字节为单位显示信息,这不是很容易读取的格式。 您可以使用以下选项以人类可读的格式显示磁盘空间。

-h – displays disk space in GB (Gigabytes)

-h –以GB(千兆字节)显示磁盘空间

$ df -h

Sample output

样品输出

-m – displays disk space in MB (Megabytes)

-m –以MB(兆字节)为单位显示磁盘空间

$ df -m

Sample output

样品输出

显示文件系统的类型 (Display the type of file system)

To display the file system type of your system’s mount points, use the -T flag as shown below

要显示系统安装点的文件系统类型,请使用-T标志,如下所示

$ df -T

Sample output

样品输出

检查特定目录的磁盘空间 (Check disk space of a specific directory)

To check the disk space of a specific directory, use the syntax below:

要检查特定目录的磁盘空间,请使用以下语法:

$ df -Th /directory_name

For example, to check disk space on the /var directory , execute the command:

例如,要检查/var目录上的磁盘空间,请执行以下命令:

$ df -Th /var

Sample output

样品输出

显示特定的文件系统 (Display a specific file system)

If you wish to display a specific file system, use the -t option followed by the filesystem type.

For example, To display the ext4 filesystem , execute the command :

如果要显示特定的文件系统,请使用-t选项,后跟文件系统类型。

例如,要显示ext4文件系统,请执行以下命令:

$ df -t  ext4

Sample output

样品输出

从显示中排除某种文件系统类型 (Exclude a certain file system type from getting displayed)

If, say , you want to display all file systems apart from the ext4 type , use the -x command as shown

例如,如果要显示除ext4类型之外的所有文件系统,请使用-x命令,如下所示

$ df -x  ext4

Sample output

样品输出

显示文件系统索引节点 (Display file system inodes)

To display information of the number of used inodes and their corresponding percentage in the filesystem, use the -i option as shown:

要显示文件系统中已使用的inode数量及其对应百分比的信息,请使用-i选项,如下所示:

$ df -i

Sample output

样品输出

获取有关df命令的帮助 (Getting help with df commands)

To get your way around with more command options visit the df man page as shown

要使用更多命令选项来解决问题,请访问df手册页,如图所示

$ man df

Sample output

样品输出

Additionally, to get help run the command

此外,要获取帮助,请运行命令

$ df --help

Sample output

样品输出

结论 (Conclusion)

That was on an overviews of the various df command options. In this guide, we walked you through how you can check disk space in Linux. Feel free to try out the commands and leave your feedback.

那是各种df命令选项的概述。 在本指南中,我们向您介绍了如何在Linux中检查磁盘空间。 随意尝试命令并留下您的反馈。

翻译自:

df 命令查看磁盘空间

转载地址:http://ejlzd.baihongyu.com/

你可能感兴趣的文章
null?对象?异常?到底应该如何返回错误信息
查看>>
django登录验证码操作
查看>>
(简单)华为Nova青春 WAS-AL00的USB调试模式在哪里开启的流程
查看>>
图论知识,博客
查看>>
[原创]一篇无关技术的小日记(仅作暂存)
查看>>
20145303刘俊谦 Exp7 网络欺诈技术防范
查看>>
原生和jQuery的ajax用法
查看>>
iOS开发播放文本
查看>>
20145202马超《java》实验5
查看>>
JQuery 事件
查看>>
main(argc,argv[])
查看>>
第四阶段 15_Linux tomcat安装与配置
查看>>
NAS 创建大文件
查看>>
学习笔记-模块之xml文件处理
查看>>
接口测试用例
查看>>
Sybase IQ导出文件的几种方式
查看>>
案例:手动输入一个字符串,打散放进一个列表,小写字母反序 大写字母保持不变...
查看>>
linux 系统下 tar 的压缩与解压缩命令
查看>>
阿里负载均衡,配置中间证书问题(在starcom申请免费DV ssl)
查看>>
转:How to force a wordbreaker to be used in Sharepoint Search
查看>>