Re: [ILUG] kill process by name

From: Philip Reynolds (phil at domain redbrick.dcu.ie)
Date: Tue 16 Jul 2002 - 20:41:07 IST


Kenn Humborg's [kenn at domain bluetree.ie] 31 lines of wisdom included:
> > hrishy wrote:
> > ps -ao pid,args | grep 'command' | awk '{print $1}' | xargs kill
>
> I've seen this kind of thing a lot, and it's always
> bugged me...
>
> There is nothing to prevent the grep command itself being killed
> before it finishes. When I'm doing this by hand, I always
> do:
>
> ps ax | grep something | grep -v grep | ...

what would be quicker (and more elegant) would be

ps ax | grep "[s]omething" | ...

-- 
  Philip Reynolds        
   RFC Networks          tel: 01 8832063
www.rfc-networks.ie      fax: 01 8832041


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:17:56 GMT