排除某些文件夹

grep -rl 'search' ./ --exclude-dir={\environments,\cache} --exclude=*.{bak~,bak}

参考: https://blog.csdn.net/Liuboxx1/article/details/85330320

搜索指定后缀名

grep -nr "struct irq_chip" --include="*.c" 

在指定文件夹中搜索指定后缀名

grep -nr "struct irq_chip" --include="*.c" drivers/

发表评论