How do I verify which ports are listening in Linux?



  • Type nmap followed by the IP or hostname of the host you want to query.

    # nmap 192.168.1.65
    
    Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2009-07-21 09:24 BST
    Stats: 0:00:24 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
    SYN Stealth Scan Timing: About 2.45% done; ETC: 09:41 (0:15:54 remaining)
    Stats: 0:02:00 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
    SYN Stealth Scan Timing: About 8.35% done; ETC: 09:49 (0:22:02 remaining)
    Stats: 0:20:45 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
    SYN Stealth Scan Timing: About 75.20% done; ETC: 09:52 (0:06:50 remaining)
    Interesting ports on Unknown-00-0c-29-8a-13-db.home (192.168.1.65):
    Not shown: 1678 filtered ports
    PORT    STATE  SERVICE
    22/tcp  open   ssh
    631/tcp closed ipp
    MAC Address: 00:0C:29:8A:13:DB (VMware)
    
    Nmap finished: 1 IP address (1 host up) scanned in 1675.784 seconds
    

    If you press Enter before nmap has finished, you will get a progress report i.e. "About 8.35% done".

    The above example shows that, on server 192.168.1.65, port 22 is open and ssh is listening on port 22.


Log in to reply
 

© Lightnetics 2024