df命令显示磁盘空间
周期性, youmayneedtomonitororcheckthediskspaceonyoursystemtoensurethatyouhaveenoughspacetoinstallsoftwarepackagesorsavefiles.there are etforcheckingdiskspace.linuxcomeswithitsownbuilt-inutilitycalleddforcheckingtheamountofdiskspace on your system.in this artis
您可能需要定期监视或检查系统的磁盘空间,以确保有足够的空间安装软件包或保存文件。 互联网上有很多检查磁盘空间的工具。 Linux具有自己的内置实用程序df,用于检查系统上的磁盘空间。 本文介绍如何使用df命令在Linux上检查磁盘空间。
使用Linux df命令检查磁盘空间(checkdiskspaceusinglinuxdfcommand ) the http://www.Sina.com/commandwithoutanyoptionsdisplaystion
运行不带选项的df命令可显示总块数、已用空间、可用磁盘空间和文件系统装载点。
$ df df
Sample output
检查所有文件系统的“磁盘空间of all file systems”todisplaydiskspaceofallfilesystems。 use the-aoptionasshown.apartfromdisplayingtheconventionalfilesystems,the-aoptiondisplaysdumyfilesystems 3360
要显示所有文件系统的磁盘空间,请使用-a选项,如图所示。 除了常规文件系统外,-a选项还显示虚拟文件系统。
$ df -a 样品输出
Sample output
磁盘空间(checkdiskspaceinhumanreadableformat ) aspreviouslyseen http://www.Sina.com/commanddisplaysinformationinbyten whichisnotexactlyeasytoreadformat.youcandisplaydiskspaceinahuman-readableformatusingthefollowingoptions。
如前所述,样品输出命令以字节为单位显示信息。 这不是易读的格式。 可以使用以下选项以人类可读格式显示磁盘空间:
- h显示磁盘空间(gigabytes ) )。
-h-以千兆字节为单位显示磁盘空间
$ df -h df
df
- mdisplaysdiskspaceinmb (megabytes ) )。
- m以MB (兆字节)为单位显示磁盘空间
$ df -m Sample output
样品输出
文件系统类型(Display the type of file system ) todisplaythefilesystemtypeofyoursystem’smountpoints,use the -T flag as shown below
要显示系统挂载点的文件系统类型,请使用-T标志,如下所示
$ df -T Sample output
样品输出
检查特定目录的磁盘空间(checkdiskspaceofaspecificdirectory ) tocheckthediskspaceofaspecificdirectory,use the syntax below:
要检查特定目录的磁盘空间,请使用以下语法:
$ df-th/directory _ name for example,tocheckdiskspaceonthe/vardirectory,execute the command:
例如,要确定/var目录的磁盘空间,请运行以下命令:
$ df -Th /var Sample output
样品输出
特定文件系统(Display a specific file system ) ifyouwishtodisplayaspecificfilesystem,use the-toptionfollowedbythefilesystemtype
For example,To display the ext4 filesystem,execute the command :
要查看特定的文件系统,请在-t选项后指定文件系统类型。
例如,要查看ext4文件系统,请运行以下命令:
$ df -t ext4 Sample output
样品输出
文件系统类型(excludeacertainfilesystemtypefromgettingdisplayed ) If,say,youwanttodisplayallfilesystemsapartfromtheext4typartttext
例如,要显示除ext4类型以外的所有文件系统,请使用-x命令
$ df -x ext4 Sample output
样品输出
文件系统索引节点(Display file system inodes ) todisplayinformationofthenumberofusedinodesandtheircorrespondingpercentageinthefonth
要显示文件系统中使用的inode数量及其相应百分比的信息,请使用-i选项:
$ df -i Sample output
样品输出
df命令帮助(Getting help with df commands ) togetyourwayaroundwithmorecommandoptionsvisitthedfmanpageasshown
要使用更多命令选项解决问题,请访问df手册页,如图所示
$ man df Sample output
样品输出
Additionally,to get help run the command
此外,要获得帮助,请运行命令
$ df --help Sample output
样品输出
结论(Conclusion ) thatwasonanoverviewsofthevariousdfcommandoptions.in this guide,wewalkedyouthroughhowyoucancheckdiskspaceinlskspaceinlstion
那是各种df命令选项的概要。 本指南介绍如何在Linux上检查磁盘空间。 请尝试命令并留下反馈。
3:https://www.journal dev.com/28753/Linux-df-command-check-disk-space翻译
df命令显示磁盘空间