码迷,mamicode.com
首页 > 系统相关 > 详细

linux查看端口被占用情况

时间:2015-01-18 13:13:47      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:linux查看端口被占用情况

1.Fedora20系统下启动一个jetty服务器.端口8080;

2.执行命令,会显示如下:

[doctor@localhost bin]$ lsof -i:8080
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    10033 doctor  180u  IPv6 253547      0t0  TCP *:webcache (LISTEN)
[doctor@localhost bin]$ 

得到PID 10033.

3.执行命令:

[doctor@localhost ~]$ ps aux |grep 10033
doctor   10033  1.7 12.4 6044780 979184 pts/1  Sl   11:07   0:34 /home/doctor/opt/jdk1.8.0_25/bin/java -Djetty.home=/home/doctor/opt/jetty9-jenkins -Djetty.base=/home/doctor/opt/jetty9-jenkins -Djava.io.tmpdir=/tmp -jar /home/doctor/opt/jetty9-jenkins/start.jar jetty-started.xml
doctor   10874  0.0  0.0 112696  2300 pts/1    S+   11:41   0:00 grep --color=auto 10033
[doctor@localhost ~]$ 

或者

[doctor@localhost ~]$ ps u 10033 |cat
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
doctor   10033  1.5 12.4 6044780 979184 pts/1  Sl   11:07   0:34 /home/doctor/opt/jdk1.8.0_25/bin/java -Djetty.home=/home/doctor/opt/jetty9-jenkins -Djetty.base=/home/doctor/opt/jetty9-jenkins -Djava.io.tmpdir=/tmp -jar /home/doctor/opt/jetty9-jenkins/start.jar jetty-started.xml
[doctor@localhost ~]$ 

后面的cat显示主要是为了换行,这样信息显示的全.

linux查看端口被占用情况

标签:linux查看端口被占用情况

原文地址:http://blog.csdn.net/doctor_who2004/article/details/42834479

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!