批量kill掉带有某些标识的进程的shell命令

9774376-eaa939b8cca508e9
WELTest

分享一个常用命令,批量杀掉一批进程,这里以tomcat为例:

ps -ef | grep tomcat | awk '{print $2}' | xargs kill -9

命令解析:

ps -ef | grep tomcat :查找带有tomcat的进程。

ps -ef | grep tomcat | awk '{print $2}':获取带有tomcat的进程ID

ps -ef | grep tomcat | awk '{print $2}' | xargs kill -9:把带有tomcat的进程ID,作为参数传给xargs kill -9,来杀掉带有tomcat的进程。

9774376-8182ae78bb2ed3c7
扫码关注我们
发布了592 篇原创文章 · 获赞 221 · 访问量 130万+

猜你喜欢

转载自blog.csdn.net/henni_719/article/details/103096277