Linux通过os进程pid找到端口号

本文发布时间: 2019-Mar-22
[root@localhost ~]# netstat -tulpnActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN 3338/./hpiod tcp 0 0 0.0.0.0:736 0.0.0.0:* LISTEN 3098/rpc.statd tcp 0 0 127.0.0.1:37094 0.0.0.0:* LISTEN 4418/ocssd.bin tcp 0 0 0.0.0.0:54955 0.0.0.0:* LISTEN 4919/ora_d000_orcl tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 3058/portmap tcp 0 0 0.0.0.0:1521 0.0.0.0:* LISTEN 4974/tnslsnr tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3358/sshd tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 3369/cupsd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3404/sendmail tcp 0 0 127.0.0.1:43259 0.0.0.0:* LISTEN 4418/ocssd.bin tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN 3343/python udp 0 0 127.0.0.1:33429 0.0.0.0:* 4418/ocssd.bin udp 0 0 127.0.0.1:20633 0.0.0.0:* 4921/ora_s000_orcl udp 0 0 0.0.0.0:21080 0.0.0.0:* 3763/avahi-daemon udp 0 0 127.0.0.1:13017 0.0.0.0:* 4891/ora_pmon_orcl udp 0 0 0.0.0.0:730 0.0.0.0:* 3098/rpc.statd udp 0 0 0.0.0.0:733 0.0.0.0:* 3098/rpc.statd udp 0 0 127.0.0.1:7394 0.0.0.0:* 4418/ocssd.bin udp 0 0 0.0.0.0:5353 0.0.0.0:* 3763/avahi-daemon udp 0 0 127.0.0.1:63341 0.0.0.0:* 4418/ocssd.bin udp 0 0 0.0.0.0:111 0.0.0.0:* 3058/portmap udp 0 0 0.0.0.0:631 0.0.0.0:* 3369/cupsd udp 0 0 127.0.0.1:16633 0.0.0.0:* 4919/ora_d000_orcl udp 0 0 127.0.0.1:61818 0.0.0.0:* 4418/ocssd.bin 下面根据os进程id(4974)检查使用的端口号:[root@localhost ~]# netstat -nap | grep 4974tcp 0 0 0.0.0.0:1521 0.0.0.0:* LISTEN 4974/tnslsnr tcp 0 0 127.0.0.1:1521 127.0.0.1:11798 ESTABLISHED 4974/tnslsnr unix 2 [ ACC ] STREAM LISTENING 15990 4974/tnslsnr /var/tmp/.oracle/s#4974.1unix 2 [ ACC ] STREAM LISTENING 15992 4974/tnslsnr /var/tmp/.oracle/s#4974.2unix 3 [ ] STREAM CONNECTED 14974 4663/gconfd-2 [root@localhost ~]#


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:09pm
栏目列表