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?
问题:
回答1:
Try 'killall bash' or 'killall -9 bash' if they resist that.
回答2:
The killall command can kill all processes with a given name:
killall bash
回答3:
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!
回答4:
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.
回答5:
Know the filename of the executable? You can use "killall " on many Unix systems.
# killall <name>
回答6:
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.