linux命令学习之——find
关于find grep awk 的简单例子:https://zhuanlan.zhihu.com/p/64375694
find命令
在home目录下寻找所有.txt结尾的文件
-
find /home/ -name "text.txt"
管道查看
-
find /home/ -name "text.txt" | more
当显示内容太多,可以加管道符more进行分页查看,space是翻页,enter是下一行,q退出:
区分文件和目录
-
find /home/ -name "*.txt" -type f
type可以区分file或者directory:
当前目录查找
-
find . "*.so" 当前目录查找so结尾的:
- 用
.
代表当前,注意不会查找子目录
30天之前修改的
find . "*.txt" -type f -mtine +30
find 递归/不递归 查找子目录的方法
- 递归查找(find 命令 是递归遍历文件夹的)
命令:find . -name “*.txt”
//当前路径下递归查找以.txt结尾的文件夹
- 不递归查找:
- 命令
find . -name “*.txt” -maxdepth 1
//当前路径下不递归查找以.txt结尾的文件夹,-maxdepth 1表示查找深度为1