shell 杀死指定端口的进程

2017-10-10  本文已影响0人  Josaber

查询所在端口进程

$ netstat -nlp | grep :8080 | awk '{print $7}' | awk -F"/" '{ print $1 }'
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
1817

杀死指定ID进程

$ kill -9 1817

杀死指定端口进程

$ kill -9 $(netstat -nlp | grep :8080 | awk '{print $7}' | awk -F"/" '{ print $1 }')
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)

PS:
测试环境:Ubuntu 14.04.5 LTS

上一篇下一篇

猜你喜欢

热点阅读