Bash:用管道杀死
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16931172/
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
Bash: kill with pipe
提问by Bin Zhou
Trying to killvery process related to Java. Is there a way to use pipe for it? I have tried
尝试kill与Java相关的非常进程。有没有办法使用管道?我试过了
ps -e|grep "java"|kill
ps -e|grep "java"|kill
and
和
ps -e|grep "java"|xargs kill
ps -e|grep "java"|xargs kill
Neither works.
两者都不起作用。
回答by perreal
回答by antak
There is, but this is easier (presuming your system has killall):
有,但这更容易(假设您的系统有killall):
killall java
回答by uli42
You can also use pkill java. pkillis pgrepand killcombined into one command.
您也可以使用pkill java. pkill是pgrep并kill组合成一个命令。

