How can I kill all shells in Unix at once?
Question
My Mac becomes slow over time. The reason is the huge amount of my shells, such as Bashes and Fishes. Each shell has different PID. Killing shells one by one is too cumbersome. How can I kill them at once?
Solution
Try 'killall bash' or 'killall -9 bash' if they resist that.
OTHER TIPS
The killall command can kill all processes with a given name:
killall bash
As per other answers, the usual command is killall
.
Note though that on some versions of UNIX (e.g. DEC Unix) this command literally kills all processes.
Do make sure that you know which behaviour your UNIX has before using it!
I strongly doubt your initial diagnosis. In Unix, an inactive process does not take resources. It is not scheduled, its memory is swapped out, etc. If there is a problem of slowness, it probably has another cause. Running top is the first step.
Know the filename of the executable? You can use "killall " on many Unix systems.
# killall <name>
I think that you cannot kill all your Shells at once. You have to use many killalls, separately to each Shell like Rjamestaylor says above:
killall bash
killall fish
And so on.