linux 根据端口kill掉进程

#杀掉8080端口的进程

netstat -nlp |grep :8080 |grep -v grep|awk '{print $7}' |awk -F '/' '{print $1}' |xargs kill -9

 

#查询包含tomcat的进程号

ps -ef|grep tomcat|grep -v grep|awk '{print $2}'

 

#杀掉所有包含‘tomcat’的进程

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

posted @ 2018-03-01 17:56  blange  阅读(621)  评论(0编辑  收藏  举报