Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

Is there any other way to do this?

share|improve this question

migrated from stackoverflow.com Apr 5 '10 at 17:13

This question came from our site for professional and enthusiast programmers.

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

share|improve this answer
    
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 Apr 5 '10 at 17:14

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]
share|improve this answer

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

share|improve this answer

You must log in to answer this question.