教学之友,学习之友。

站长教学网

Linux下如何查看目录和磁盘空间大小使用情况

时间:2012-02-22 00:32来源:未知 作者:admin 点击:

du查看目录大小,df查看磁盘使用情况。
我常使用的命令(必要时,sudo使用root权限),
1.查看某个目录的大小:du -hs /home/master/documents
  查看目录下所有目录的大小并按大小降序排列:sudo du -sm /etc/* | sort -nr | less
2.查看磁盘使用情况(文件系统的使用情况):sudo df -h
  df --block-size=GB

-h是使输出结果更易于人类阅读;du -s只展示目录的使用总量(不分别展示各个子目录情况),-m是以MB为单位展示目录的大小(当然-k/-g就是KB/GB了)。
更多信息,还是man du 和 man df 来获得吧。

du - estimate file space usage
Summarize disk usage of each FILE, recursively for directories.

df - report file system disk space usage
Show information about the file system on which each FILE resides, or all file systems by default.
df displays the amount of disk space available on the file system containing each file nameargument. If no file name is given, the space available on all currently mounted file systems is shown.

(责任编辑:ken)
TAG标签: linux 磁盘 目录
顶一下
(2)
100%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
注册登录:不允许匿名留言,登录后留言无需输入验证码。
栏目列表
最新内容