文件目录管理:

1. 删除几天以前的所有目录和文件
a. find . -ctime +3 -exec rm -rf {} /;
b. find ./ -mtime +3 -print | xargs rm -f -r

2. 在多级目录中查找某个文件的方法
a. find /dir -name filename.ext
b. du -a | grep filename.ext
c. locate filename.ext

 

文件大小升序排列:
ls -lh *.log|sort -h -k5

文件占用空间大小升序排列:
ls -slh *.log|sort -h   # sort 默认使用 -k1排序

ls:
-s, --size        print the allocated size of each file, in blocks

 

posted on 2021-01-15 17:13  51core  阅读(129)  评论(0)    收藏  举报