Killing all Ruby Processes

I was running some commands that I later found out had left me with many orphaned ruby processes. Too many to kill one by one. I needed to just get rid of them all and quickly so killing all ruby processes was the best way to go. Here is a short list of convenient and inconvenient ways to do that: for each in `ps -eo pid,command | grep ruby | grep -v grep | awk '{print $1}' `; do kill -9 $each;done killall −9 ruby pkill -9 ruby pidof ruby | xargs kill -9 ps aux | grep sidekiq | awk '{print $2}' | xargs kill The easiest commands and best suggestions were brought to my attention by Alan Bailward and Gavin Mogan.

Continue reading

Author's picture

Brian Pearce

Software Developer, Endurance Cyclist,
Rubiest, Rustacean, and Gopher

Software Engineer

Barcelona, Spain