您的位置:首页 > 运维架构 > Linux

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

2015-03-05 15:42 288 查看
[root@localhost ~]# netstat -tulpn
Active 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 4974
tcp        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.1
unix  2      [ ACC ]     STREAM     LISTENING     15992  4974/tnslsnr        /var/tmp/.oracle/s#4974.2
unix  3      [ ]         STREAM     CONNECTED     14974  4663/gconfd-2       
[root@localhost ~]#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: