码迷,mamicode.com
首页 > 其他好文 > 详细

查询指定目录下所有子目录的大小

时间:2017-03-23 15:54:00      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:div   span   class   bin   oca   bash   cat   code   tail   

 1 [root@localhost ~]# cat x.sh 
 2 #!/bin/bash
 3 
 4 fun_x () {
 5 
 6     du -h $1 |tail -1
 7 
 8 }
 9 
10 for i in `ls $1`
11 do
12     fun_x $1$i
13 done
14 [root@localhost ~]# sh x.sh /usr/
15 132M    /usr/bin
16 4.0K    /usr/etc
17 4.0K    /usr/games
18 34M    /usr/include
19 325M    /usr/lib
20 447M    /usr/lib64
21 34M    /usr/libexec
22 6.1G    /usr/local
23 28M    /usr/sbin
24 1.1G    /usr/share
25 48M    /usr/src
26 0    /usr/tmp
27 [root@localhost ~]# 

 

查询指定目录下所有子目录的大小

标签:div   span   class   bin   oca   bash   cat   code   tail   

原文地址:http://www.cnblogs.com/www1707/p/6605505.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!