Last Updated: May 04, 2019
·
1.788K
· davidann

How to kill (a great many) processes

Sometimes Resque processes hang. Here's a snippet that helped me kill stale processes:

for pid in `ps aux | grep resque | awk '{print $2}'`; do 
  kill -9 $pid;
done

Alternatively, you could also do:

ps aux | grep resque | awk '{print $2}' | xargs kill

3 Responses
Add your response

With a bash function you can kill processes by name like this:

function killallp() {
  kill `ps -ef | grep $1 | grep -v grep | awk '{print $2}'`;
}
$ killallp resque
over 1 year ago ·

@runexec Thanks!

over 1 year ago ·

@endel Thanks!

over 1 year ago ·