Chinaunix
标题:
"ps aux | grep app" 如何才能不顯示grep app本身
[打印本页]
作者:
ztkx
时间:
2010-08-13 01:16
标题:
"ps aux | grep app" 如何才能不顯示grep app本身
ps aux | grep app
返回的結果中,包含app的進程,也包含grep app本身
問題在於grep app本身對於進程查詢是沒有意義的,所以其實沒必要顯示它
那麽,如何讓grep app不顯示呢
以前看到過,但是沒記住,好像是修改grep的正則表達式
作者:
waker
时间:
2010-08-13 06:12
\[a]pp
man grep就能看到
作者:
justlooks
时间:
2010-08-13 08:34
学到了,还能这么用
作者:
Shell_HAT
时间:
2010-08-13 09:02
ps aux | grep app | grep -v "grep"
复制代码
作者:
只爱睡觉
时间:
2010-08-13 09:04
楼上正解。
作者:
wild_li
时间:
2010-08-13 10:24
-v
作者:
yanu
时间:
2010-08-13 10:59
\[a]pp
man grep就能看到
waker 发表于 2010-08-13 06:12
这个方法漂亮..
作者:
ztkx
时间:
2010-08-13 12:10
\[a]pp
man grep就能看到
waker 发表于 2010-08-13 06:12
這個是正解,自己不認真,慚愧
作者:
beginner-bj
时间:
2010-08-13 12:39
我一般都写[a]pp,不写\[a]pp,感觉没什么区别。
作者:
beginner-bj
时间:
2010-08-13 12:48
12:45:07 root@ST-TEST:[/]#ps aux | grep [a]pp
root 0 0.0 0.0 384 320 - A May 09 70:22 swapper
12:45:18 root@ST-TEST:[/]#ps aux | grep vi
root 692402 0.0 0.0 656 600 pts/1 A 12:44:55 0:00 vi [a]pp
12:45:26 root@ST-TEST:[/]#ps aux | grep \[a]pp
root 0 0.0 0.0 384 320 - A May 09 70:22 swapper
12:45:44 root@ST-TEST:[/]#ps aux | grep \[a\]pp
root 0 0.0 0.0 384 320 - A May 09 70:22 swapper
12:46:04 root@ST-TEST:[/]#ps aux | grep \\[a\\]pp
root 692402 0.0 0.0 656 16 pts/1 A 12:44:55 0:00 vi [a]pp
12:46:38 root@ST-TEST:[/]#
复制代码
作者:
逸&moto163
时间:
2010-08-13 16:10
学到了!
作者:
kaylo
时间:
2010-08-13 17:24
回复
9#
beginner-bj
$ ps -ef |grep
mon
No match.
不加\不行
作者:
ailms
时间:
2010-08-14 17:39
用 pgrep 嘛,自动过滤
作者:
qishking
时间:
2010-08-14 20:28
学习
作者:
etoux
时间:
2010-08-14 22:24
学习了··
作者:
cu_eagle
时间:
2010-08-15 21:31
ps aux | grep app |grep -v grep
作者:
firocu
时间:
2013-11-11 11:26
有人能说说[a]pp这个原理是什么吗?
作者:
trdcaz
时间:
2013-11-11 14:47
回复
2#
waker
请问下,man grep的信息在哪,我man grep怎么没找到呢?
作者:
ttt3278
时间:
2013-11-11 16:08
本帖最后由 ttt3278 于 2013-11-11 16:11 编辑
回复
18#
trdcaz
我也没有man到,是google到的,看下这3个url就明白了。居然可以这么搞:
http://serverfault.com/questions ... ep-from-the-results
http://serverfault.com/questions ... -own-process/367936
http://www.commandlinefu.com/com ... uded-in-description
作者:
trdcaz
时间:
2013-11-11 17:12
回复
19#
ttt3278
thx
作者:
davidbeckham921
时间:
2013-11-11 17:55
厉害!学习了!之前没注意过这样也可以。
作者:
freeterman
时间:
2014-05-09 15:12
帅
回复
2#
waker
作者:
tdounnyy
时间:
2014-05-09 15:57
[a]pp
a[p]p
ap[p]
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2