搜索文件内容
grep 'text' hello.txt
grep -i 'text' hello.txt
grep 'text' hello.txt hi.txt
grep 'text' *
grep -R 'text' *
匹配搜索
- 搜索 pip 配置文件的路径 -R(遍历) -n(行号) -H(文件名)
grep "index-url" ~/.config -RnH
/home/lnsoft/.config/pip/pip.conf:2:index-url = https://mirrors.aliyun.com/pypi/simple/
find ~ -name pip* | xargs -i grep "index-url" {} --color -nH
/home/lnsoft/.config/pip/pip.conf:2:index-url = https://mirrors.aliyun.com/pypi/simple/
find . | grep -F .run
统计 [目录 | 文件] 数
ll | grep '^d'
ll | grep '^-'
ll -R | grep '^d'
ll | grep '^d' | wc -l
参考资料