我想遍历所有子目录,除了“node_modules”目录。
当前回答
find . ! -name "node_modules" -type d
其他回答
步骤1:
vim ~ / . bash_profile
search() {
grep -InH -r --exclude-dir=*build* -e "$1" .
}
步骤2:
源~ / . bash_profile
用法:
搜索”< string_to_be_searched >”
你可以试试grep -R搜索。| grep -v '^node_modules/.*'
find . ! -name "node_modules" -type d
非常有用,特别是对于那些处理Node.js时,我们希望避免在“node_modules”中搜索:
find ./ -not -path "*/node_modules/*" -name "*.js" | xargs grep keyword
一个简单的工作命令:
root/dspace# grep -r --exclude-dir={log,assetstore} "creativecommons.org"
上面我grep文本“creativecommons.org”在当前目录“dspace”和排除dirs{日志,资产存储}。
完成了。
推荐文章
- 使用sudo时未找到命令
- 当有命令行参数时,如何使用GDB分析程序的核心转储文件?
- 如何使用查找命令从列表中查找所有具有扩展名的文件?
- 如何强制从另一个SSH会话分离屏幕?
- 如何将文件指针(file * fp)转换为文件描述符(int fd)?
- Linux Bash中双&和分号有什么区别?
- 在SSH会话中查找客户端的IP地址
- C++ Linux的想法?
- 如何为Fedora安装g++ ?
- Linux删除大小为0的文件
- Spring引导应用程序作为服务
- 如何重定向标准derr和标准输出到不同的文件在同一行脚本?
- Windows和Linux上的c++编译:ifdef开关
- 在Bash中获取日期(比当前时间早一天)
- Linux: kill后台任务