Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

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

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

3 Answers

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
add comment

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
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.