0

Can we just put all the processes in one group and kill that group?

Is there any other way to do this?

3 Answers 3

2

Passing kill a negative PID other than -1 will send the signal to the PGID with the same absolute value.

1
  • If you are using the command, as opposed to the C function/system call, then use -- to ensure that the negative number is not interpreted as a command option. e.g. kill -- -123.
    – mark4o
    Commented Apr 5, 2010 at 17:14
1

If the processes are not in the same process group, you can't use a negative PID, but you can list more than one PID on the command line:

kill 1001 1010 1234 2109

Or if the processes have the same or similar names you can use a regular expression:

pkill some_prog[a-d]
0

I think you are looking for pkill -P [parent id], but that parent process has to spawn the children.

You must log in to answer this question.