查看一个进程对应的端口号

一、liunx 下
1.查找指定目标项目(atf web工程)进程的pid

 ps -aux | grep atf
 root      3582  0.1 11.2 382228 190588 ?       Sl   09:31   0:19 java -Datf -jar start.jar etc/jetty.xml
 root     22121  0.0  0.0   1644   508 pts/1    R+   12:12   0:00 grep atf


2.在全部端口中查找进程号为 pid=3582(atf项目的进程号) 的信息
 netstat -naop | grep 3582
 tcp6       0      0 :::8080                 :::*                    LISTEN     3582/java           off (0.00/0/0)
 tcp6       0      0 :::8443                 :::*                    LISTEN     3582/java           off (0.00/0/0)
 tcp6       0      0 ::ffff:192.168.6.:49454 ::ffff:192.168.6.1:1531 ESTABLISHED3582/java           off (0.00/0/0)
 tcp6       0      0 ::ffff:192.168.6.:49593 ::ffff:192.168.6.:61616 ESTABLISHED3582/java           off (0.00/0/0)
 tcp6       0      0 ::ffff:192.168.6.:34871 ::ffff:192.168.6.1:1531 ESTABLISHED3582/java           off (0.00/0/0)
 tcp6       0      0 ::ffff:192.168.6.2:8080 ::ffff:192.168.88.:3692 ESTABLISHED3582/java           off (0.00/0/0)
 tcp6       0      0 ::ffff:192.168.6.2:8080 ::ffff:192.168.88.:3689 ESTABLISHED3582/java           off (0.00/0/0)
 tcp6       0      0 ::ffff:192.168.6.2:8443 ::ffff:192.168.88.:3695 ESTABLISHED3582/java           off (0.00/0/0)
 tcp6       0      0 ::ffff:192.168.6.2:8443 ::ffff:192.168.88.:3697 ESTABLISHED3582/java           off (0.00/0/0)


其中 :::8080 和:::8443  是 atf项目打开的端口号,
其他是已经和atf建立连接的请求服务。

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。