LoveUnix » AIX -IBM UNIX » ps和kill的组合命令
让LU留住您的每

一天 让LU博客留住您的每一天
2008-8-6 09:50 lpq_1_5
ps和kill的组合命令

大家好!
    我想kill 所有的ps -ef|grep vac的进程,这个组合命令是如何写的呢?

2008-8-6 10:36 larryh
kill -9 `ps -ef|grep vac|grep -v grep|cut -c 9-15`

2008-8-6 11:21 lpq_1_5
thank you

2008-8-7 11:46 george16
cut -c 9-15是啥意思?

2008-8-7 11:50 炸鸡
用户名是8位,所以占用1-8,9位是空格,10-15是pid

2008-8-7 11:50 ChaosLegion
man cut;P

2008-8-7 11:50 jingsun
ps -ef | grep vac | grep -v grep | awk '{print $2}' | xargs kill -9

2008-8-7 11:51 炸鸡
我刚刚man的。:lol

2008-8-7 11:55 george16
cut -c 9-15是啥意思?

2008-8-7 12:16 myciciy
学习了

2008-8-7 13:06 炸鸡
[quote]原帖由 [i]george16[/i] 于 2008-8-7 11:55 发表 [url=http://bbs.loveunix.net/redirect.php?goto=findpost&pid=817585&ptid=88019][img]http://bbs.loveunix.net/images/common/back.gif[/img][/url]
cut -c 9-15是啥意思? [/quote]

靠,还问?直接拉出去format掉。:mad

2008-8-7 14:23 咔叮枫情
[quote]原帖由 [i]炸鸡[/i] 于 2008-8-7 01:06 PM 发表 [url=http://www.loveunix.com/redirect.php?goto=findpost&pid=817613&ptid=88019][img]http://www.loveunix.com/images/common/back.gif[/img][/url]


靠,还问?直接拉出去format掉。:mad [/quote]

;P

2008-8-8 01:03 george16
[quote]原帖由 [i]炸鸡[/i] 于 2008-8-7 13:06 发表 [url=http://www.loveunix.com/redirect.php?goto=findpost&pid=817613&ptid=88019][img]http://www.loveunix.com/images/common/back.gif[/img][/url]


靠,还问?直接拉出去format掉。:mad [/quote]

The network has some problem for me at that time.

2008-8-8 01:46 george16
[quote]原帖由 [i]jingsun[/i] 于 2008-8-7 11:50 发表 [url=http://www.loveunix.com/redirect.php?goto=findpost&pid=817583&ptid=88019][img]http://www.loveunix.com/images/common/back.gif[/img][/url]
ps -ef | grep vac | grep -v grep | awk '{print $2}' | xargs kill -9 [/quote]

This one is better.

2008-8-8 13:32 ibelieveforever
学习啦

页: [1]
查看完整版本: ps和kill的组合命令


Powered by Discuz! Archiver 5.5.0  © 2001-2006 Comsenz Inc.