Can we just put all the processes in one group and kill that group?
Is there any other way to do this?
Passing kill
a negative PID other than -1
will send the signal to the PGID with the same absolute value.
--
to ensure that the negative number is not interpreted as a command option. e.g. kill -- -123
.
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]
I think you are looking for pkill -P [parent id], but that parent process has to spawn the children.