find
- 按文件名查找
find ./ -name hello
find ./ -name "hello\*" #当使用通配符时要使用引号
1
2
2
- 在查找文件内容,这里 xargs 将文件转化为了 grep 的参数
find .| xargs grep hello
1
- 过滤文件类型
find . -type f -name hello #查找文件名为 hello 的文件
find . -type d -name hello #查找文件名为 hello 的目录
1
2
2
- find 命令设置递归深度
find . -maxdepth 1 -name "\*.txt"
1
编辑 (opens new window)
上次更新: 2024/03/02, 18:30:15