3

Recently I unintentionally created and run a fork bomb in bash. It was a slow one, in comparison to other fork bombs, I had plenty of time to do something. But there were already several hundreds of bash instances when I found out though.

My first thought was to do

killall bash

but this kills the shell I'm in and the killall with it.

Then I ran :!killall bash from Vim and it was settled.

But what if I had no Vim running? Every terminal I have starts bash by default. How could I kill every bash instance but the one I'm in?

2

2 Answers 2

2

I figured I can do exactly what I'm asking, kill every bash instance but the one I'm in.

pgrep bash | grep -v $$ | xargs kill
0

just look for the pid and then -

while true; do killall -u pid; done

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .