linux下,find递归搜索文件或目录,grep递归搜索文本

来源:互联网 发布:真王精灵辅助淘宝 编辑:程序博客网 时间:2024/05/22 12:54
1:递归搜索,删除目录和文件
find ./test/ -type f -name ".gitignore"
find ./test/ -type f -name ".gitignore" | xargs rm -rf
find ./test/ -type d -name ".svn"
find ./test/ -type d -name ".svn" | xargs rm -rf

2:在子目录下搜索包含指定字符串的文件

grep -i -r "test text" ./*


3:批量文件查找

find -name "*.c" | xargs grep -r -i "text"