秦书磊 129 2014年12月08日 回答grep
太罗嗦,用ack吧。源码搜索的不二之选~默认排除各种版本库,可以指定多种源文件类型。
─(~/.cheat)(ruby-1.9.3-p547@rails3.1.1)────────────────────────────────────────────────────────────────────(shuleiqin@shuleiqin-F8Vr:pts/0)─┐
└─(23:14:07 on master)──> ls ──(一,12月08)─┘
alias bash crontab DirectoryArchitecture echo Git kill MachineProperties passwd Python Regex tree usermod Vi
awk Bash df du export grep less markdown python README.md shutdown useradd vi zip
┌─(~/.cheat)(ruby-1.9.3-p547@rails3.1.1)────────────────────────────────────────────────────────────────────(shuleiqin@shuleiqin-F8Vr:pts/0)─┐
└─(23:14:16 on master)──> ack grep ──(一,12月08)─┘
grep
2:grep pattern file
5:grep -i pattern file
7:
8:grep -R pattern folder
11:grep -Rl {search} {path}
14:grep -Rli {search} {path}
17:grep -f pattern_file file
20:grep -v pattern file
22:
23:grep "^00" file
24:grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" file
28:grep -rnw 'directory' -e "pattern"
30:
32:ps aux | grep '[h]ttpd'
35:ps aux | grep -E --color 'bash