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显示主要是为了换行,这样信息显示的全.
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。