如何一次杀死 Unix 中的所有 shell?
随着时间的推移,我的 Mac 变得越来越慢。 原因是我的贝壳数量巨大,例如 Bashes 和 Fishes。 每个shell都有不同的PID。 一颗颗杀炮弹太麻烦了。 怎么才能一次性杀掉他们呢?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
killall 命令可以终止具有给定名称的所有进程:
The killall command can kill all processes with a given name:
如果他们拒绝,请尝试“killall bash”或“killall -9 bash”。
Try 'killall bash' or 'killall -9 bash' if they resist that.
根据其他答案,常用的命令是
killall
。请注意,在某些版本的 UNIX(例如 DEC Unix)上,此命令实际上会杀死所有进程。
在使用 UNIX 之前,请确保您了解它的行为!
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!
我强烈怀疑你的初步诊断。 在 Unix 中,非活动进程不占用资源。 它没有被调度,它的内存被换出等等。如果出现速度慢的问题,很可能还有其他原因。 跑步是第一步。
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.
知道可执行文件的文件名吗? 您可以在许多 Unix 系统上使用“killall”。
Know the filename of the executable? You can use "killall " on many Unix systems.
我认为你不可能一次杀死所有的贝壳。 你必须使用许多killall,分别针对每个Shell,就像Rjamestaylor上面所说的那样:
等等。
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:
And so on.