find命令详解

来源:互联网 发布:unity3d awake start 编辑:程序博客网 时间:2024/06/08 05:00

1:列出当前某个目录的文件和目录

find ./

2:匹配所有以.txt结尾的文件名

find /home/root -name "*.txt" -print

3:多个条件

find . \( -name "*.txt" -o -name "*pdf" \) -print

find . -regex ".*\(\.py\|\.sh\)$"

4:否定参数

find . | -name "*.txt" -print

5:搜索的时候可以指定搜索的深度

find . -maxdepth 1 -type f -print 这样搜索的时候只会搜索当前目录的下一级目录

6:根据文件类型搜索

find . -type d -print 只会搜索目录

7:打印最近几天访问过的文件

find . -type f -atime 7 -print

待续。。。。。。。。



0 0