[Techtalk] pkill and pgrep - your friends

Kai MacTane kmactane at gothpunk.com
Tue May 2 11:31:15 EST 2006


At 05:40 PM 5/1/2006, Val Henson wrote:
>(and more dangerous) method is the pkill command.  pkill sends the
>signal to any process with the specified string as part of the process
>name.

I generally use killall for essentially the same thing. However...

>pgrep will return the pid of any process with the given string in its
>name.  This is really useful to find out which process are running,
>instead of running ps | grep <whatever>.

Ohmigod. When I think of the number of keystrokes I've wasted... especially 
in script situations, where I've done a fair number of these:

commandname `ps auxwww | grep foobar | grep -v grep | awk '{print $2}'`

Ow. My poor fingers. Thanks for the info.

                                                 --Kai MacTane
----------------------------------------------------------------------
"I'm terrified, intoxicated, starry-eyed and bollock naked,
  Child-bearing, adult-rated, and thoroughly re-educated..."
                                                 --Carter USM,
                                                  "Re-Educating Rita"



More information about the Techtalk mailing list