linux grep 忽略目录,grep 搜索目录时,怎样排除某些目录?

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:# Recursively grep for string in folder:

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:# You can grep with regular expressions

23:grep "^00" file #Match lines starting with 00

24:grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" file #Find IP add

28:grep -rnw 'directory' -e "pattern"

30:# Exclude grep from your grepped output of ps.

32:ps aux | grep '[h]ttpd'

35:ps aux | grep -E --color 'bash|$'

README.md

43:+ 每个命令的cheat,尽量不超过终端全屏下的一个屏幕。知识点的cheat原则上不限长度,但每个主题都尽量简短,方便ack或者grep查找。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值