linux 查看占用端口并kill掉

主要可以使用ps  命令 或 netstat 命令

weihong@data1:~/jd_parser/jd_parser$ ps aux | head
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  26936  1452 ?        Ss    1月18   0:41 /sbin/init
root         2  0.0  0.0      0     0 ?        S     1月18   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S     1月18   0:01 [ksoftirqd/0]

weihong@data1:~/jd_parser/jd_parser$ netstat -tlnp | head
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:9098            0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:55531         0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      -
weihong@data1:~/jd_parser/jd_parser$ netstat -tlnp | grep 8088 (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0 0.0.0.0:8088 0.0.0.0:* LISTEN 28617/python tcp6 0 0 :::8088 :::* LISTEN 28617/python
weihong@data1:
~/jd_parser/jd_parser$ kill -9 28617

 

posted on 2016-01-27 10:44  星空守望者--jkmiao  阅读(2218)  评论(0编辑  收藏  举报