Home > Notes > 结束多个进程

结束多个进程

Tue, 28 Dec 2010 17:03:35 +0800
利用管道結束多個進程。命令太長,不得不記下:
比如,結束所有php-cgi進程:
ps aux|grep php-cgi|grep -v grep|cut -c 9-15|xargs kill -9

ps aux:列出所有進程
grep php-cgi:過濾出php-cgi進程
grep -v grep:濾掉grep本身的進程
cut -c 9-15:取得進程PID,9-15剛好是PID列
xargs kill -9:在這裡了,xargs就是把剛才獲取的東東,都傳給kill。剛才獲取的是PID,所以kill -9 PIDs
Hots
评论
发表评论:


  [TIPS:首次发表评论的朋友,需要验证]
Tags
Recent Post
Recent Comments
Links
Copyright Notes
You can reship all of these articles without permission but MUST mark the original link in your post. Please contact with me() if u have advice or other arrangements.
Copyright©2007-2011 lewphee.com All rights reserved.