Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I have found myself having to regularly send kill -STOP one million processes, but they all come from the same parent. Is there a smarter way to do this?

share|improve this question
up vote 14 down vote accepted

Try pkill:

pkill -STOP -P the_ppid

If you don't have pkill, there's an alternative:

ps -o pid --ppid the_ppid --no-heading | xargs kill -STOP
share|improve this answer
perfect. Both work. Thanks! – quodlibetor Oct 7 '09 at 17:15

They might all be in the same process group? if that is the case, you can just use regular old kill command, and make the pid negative.

So to find the process group of all the apache processes:

$ sudo ps -e -o cmd,pgrp | grep apache
/usr/sbin/apache2 -k start  24065
/usr/sbin/apache2 -k start  24065
/usr/sbin/apache2 -k start  24065
/usr/sbin/apache2 -k start  24065

Then to send a signal to the whole process group:

$ sudo kill -KILL -24065
share|improve this answer
Unfortunately no, they're all subprocesses, fork()ed I think. They certainly all have different PIDs though. – quodlibetor Oct 8 '09 at 2:59
Not PID ( Process id ), Process Group ID, PGRP.... – Kyle Brandt Oct 8 '09 at 11:08
oh, jeez, I misread your answer. But, also, they aren't all in the same PGRP. But, thanks, I didn't know that trick about the negative args (in the first sentence of the manpage...) – quodlibetor Dec 20 '09 at 7:36

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.