常用linux脚本

1、如何查看根目录下每个目录下的文件个数

find ./ -maxdepth 1 -type d | while read dir;
do
count=$(find "$dir" -type f | wc -l)
echo "$dir : $count"
done

也可采用如下命令
for i in ./*; do echo $i; find $i | wc -l; done

2、如何查看当前目录下文件的大小

du -lh --max-depth=1

 

posted @ 2019-08-12 14:46  dayu.liu  阅读(152)  评论(0编辑  收藏  举报