被打开的端口谁(哪个进程)在监听? (Detect service of opened port)

作者: lesca 分类: Tutorials,Ubuntu,Web,Windows 发布时间: 2011-02-22 14:57
  • Ubuntu
  • netstat -lnput
    结果如下:

    (Not all processes could be identified, non-owned process info
     will not be shown, you would have to be root to see it all.)
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -               
    tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -               
    tcp        0      0 0.0.0.0:1723            0.0.0.0:*               LISTEN      -               
    tcp        0      0 127.0.0.1:12580         0.0.0.0:*               LISTEN      8123/adb        
    tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -               
    tcp        0      0 127.0.0.1:5037          0.0.0.0:*               LISTEN      8123/adb        
    tcp6       0      0 :::80                   :::*                    LISTEN      -               
    tcp6       0      0 :::22                   :::*                    LISTEN      -               
    tcp6       0      0 ::1:631                 :::*                    LISTEN      -               
    tcp6       0      0 :::50313                :::*                    LISTEN      5479/eclipse    
    udp        0      0 0.0.0.0:38968           0.0.0.0:*                           -               
    udp        0      0 0.0.0.0:68              0.0.0.0:*                           -               
    udp        0      0 0.0.0.0:5353            0.0.0.0:*                           -            
    

    解释:

       -l, --listening
           Show only listening sockets.  (These are omitted by default.)
       -n, --numeric
           Show numerical addresses instead of trying to determine symbolic host, port or user names.
       -p, --program
           Show the PID and name of the program to which each socket belongs.
       -u, --udp
       -t, --tcp
    
  • Windows
  • netstat -a | find "LISTENING"
    结果如下所示:

    TCP    hostname:epmap           hostname:0               LISTENING
    TCP    hostname:microsoft-ds    hostname:0               LISTENING
    TCP    hostname:10110           hostname:0               LISTENING
    TCP    hostname:netbios-ssn     hostname:0               LISTENING
    

版权声明

本文出自 Lesca 技术宅,转载时请注明出处及相应链接。

本文永久链接: https://www.lesca.cn/archives/detect-service-of-opened-port.html

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!