查询所在端口进程
$ 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