600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > df 命令查看磁盘空间_Linux df命令检查磁盘空间

df 命令查看磁盘空间_Linux df命令检查磁盘空间

时间:2020-07-08 00:47:31

相关推荐

df 命令查看磁盘空间_Linux df命令检查磁盘空间

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 calleddffor checking the amount of disk space on your system. In this article, we look at how you can check disk space in Linux using thedfcommand.

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

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

Thedfcommand 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 of all filesystems)

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

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

$ df -a

Sample output

样品输出

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

AS previously seendfcommand 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-Tflag 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/vardirectory , 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-toption followed by the filesystem type.

For example, To display theext4filesystem , 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 theext4type , use the-xcommand 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-ioption 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 variousdfcommand 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中检查磁盘空间。 随意尝试命令并留下您的反馈。

翻译自: /28753/linux-df-command-check-disk-space

df 命令查看磁盘空间

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。