[Gllug] killing a process and child processes

- Tethys tethys at gmail.com
Mon Jun 25 15:13:27 UTC 2007

On 6/25/07, salsaman at xs4all.nl <salsaman at xs4all.nl> wrote:

> But how do I get the process group of "/usr/bin/foo" ?

Paths don't have process groups -- processes do. You can find the
process group of a given process ID with:

ps --no-headers -opgid -p $pid

If you don't want to fork a separate process to do it, you can
manually pick it out of /proc/$pid/stat in your language of choice.
It's the 4th field (although watch out for whitespace in the second
field, though).


Perl is like vise grips. You can do anything with it but it is the
wrong tool for every job. -- Bruce Eckel
Gllug mailing list  -  Gllug at gllug.org.uk

More information about the GLLUG mailing list