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?
The killall command can kill all processes with a given name:
killall bash
Know the filename of the executable? You can use "killall " on many Unix systems.
# killall <name>
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 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.
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.