How can I kill all shells in Unix at once?

独自空忆成欢 提交于 2019-12-13 16:05:21

问题


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.



来源:https://stackoverflow.com/questions/455484/how-can-i-kill-all-shells-in-unix-at-once

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!