查找文件内容

find / -type f ! -path '*/node_modules/*' -name '*.js' -exec grep -l 'v10/exlibs' {} \;

查找文本

参考: https://stackoverflow.com/questions/16956810/how-do-i-find-all-files-containing-specific-text-on-linux

# 在 md 和 js 文件名查询 python, 排除一些目录
grep -s --exclude-dir={*\.*,node_modules,dist} --include=\*.{md,js} -rnwl '/Users/xw/' -e "python" -H --color
# man grep
# -r 或者-R是递归,
# -n 是行号
# -H 不显示不匹配的文件名
# -w 代表整个单词的匹配
# -l 代表“显示文件名,而不是结果”
# -s 不显示 `No such file or directory` 报错
# i 代表忽略大小写
posted @ 2019-07-18 20:51  程序媛李李李李蕾  阅读(250)  评论(0编辑  收藏  举报