Last active
August 29, 2015 14:08
-
-
Save caok/3ce58bd0ba3b715c3959 to your computer and use it in GitHub Desktop.
linux 文件数量统计
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
统计某文件夹下文件的个数 | |
ls -l |grep "^-"|wc -l | |
统计某文件夹下目录的个数 | |
ls -l |grep "^d"|wc -l | |
统计文件夹下文件的个数,包括子文件夹里的 | |
ls -lR|grep "^-"|wc -l | |
假如在一个目录中保留最近30天的文件,30天前的文件自动删除 | |
find . -mtime +30 -type f | xargs rm -rf | |
查看文件夹大小并按大小排序 | |
du -sh * | sort -n | |
查看磁盘还剩多少空间 | |
df -h | |
当前的文件夹下的磁盘使用情况 | |
du --max-depth=1 -h |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment