今天也有同学问我Linux下查看目录大小的命令,现在也将前阵子学习到du/df两个命令总结一下吧。
前阵子测试工作中有遇到过由于磁盘空间满导致程序无法执行到情况,所以使用了df和du两个命令。
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.
[来源:http://www.51testing.com/?uid-225738-action-viewspace-itemid-208965]
分类目录
- arch/management (17)
- computer (38)
- java/j2ee (304)
- lnmpa (237)
- mac/iphone/ipad/android (11)
- mysql/oracle/postgresql (126)
- os/software (74)
- other (518)
- python (6)
- redis/memcached/mongo (31)
- sitebuild (143)
随便看看
标签云
程序员 创业 人生箴言 eclipse 快捷键 术语 索引 unix命令 vim wordpress java学习笔记 环境变量 oracle内置函数 index 人生 数据类型 nohup tuxedo mysql学习笔记 MS-DOS命令 servlet spring 职场进阶 职业进阶 服务器选购 服务器选型 apache JPA MongoDB 注解 tomcat 子女教育 jquery maven JVM aix命令 网络营销 java异常 seo 人生规划 关键字 css 网络推广 struts 系统优化 成长 frame iframe bluehost jdbc select 我的信仰 oracle函数 cookie HashMap 站长工具 乱码 ArrayList secureCRT jsp session tail find halt 事务 oracle单记录函数 算法 URL window table javascript操作表单元素 String 字符串处理 健康 http 域名 情感 more google A记录 域名解析 netstat 弹出对话框 弹出窗口 框架集 框架 excel 字符串 javascript函数 showModalDialog nginx number 数组 sql frameset 开源程序 java数组 软件 oracle服务友情链接
收藏链接