bash 杀死所有睡眠进程
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46270313/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Kill all sleep processes
提问by user3874530
How do I kill all sleep processes that are running? I realize that I can either use the kill command to kill each process via its PID, or I can use pkill to kill the sleep command by name. I'm trying to figure out how I would do this, any help would be appreciated. I used
如何杀死所有正在运行的睡眠进程?我意识到我可以使用 kill 命令通过其 PID 终止每个进程,或者我可以使用 pkill 按名称终止 sleep 命令。我试图弄清楚我将如何做到这一点,任何帮助将不胜感激。我用了
man pkill
to get some help but am still unsure.
寻求帮助,但我仍然不确定。
回答by Jonathon Reinhart
回答by W. Schweinsberg
There is an option for the pkill command that will kill all processes named the given pattern.
pkill 命令有一个选项可以杀死所有命名为给定模式的进程。
pkill -x [pattern] (or) pkill -exact [pattern]
These commands will kill all processes with the same name as [pattern]
这些命令将杀死与 [pattern] 同名的所有进程