Find Processes Listening on TCP Ports

Last modified: 
Wednesday, November 2nd, 2016
Topics: 
sysadminTCP

Listing TCP processes and the ports they're listening on.

Find All TCP Processes Listening on Ports

lsof -i | grep LISTEN
idea       2403 myuser  180u  IPv4 0x45ba6555d1627ab1      0t0  TCP localhost:6942 (LISTEN)
idea       2403 myuser  482u  IPv4 0x45ba6555d1397599      0t0  TCP localhost:63342 (LISTEN)
nginx-1.8  3484 myuser    5u  IPv4 0x45ba6555c9a1a599      0t0  TCP localhost:hbci (LISTEN)
nginx-1.8  3485 myuser    5u  IPv4 0x45ba6555c9a1a599      0t0  TCP localhost:hbci (LISTEN)
node      38363 myuser   14u  IPv6 0x45ba6555dbd44c91      0t0  TCP *:cifs (LISTEN)
node      42627 myuser   14u  IPv6 0x45ba6555db6891d1      0t0  TCP *:35729 (LISTEN)
[ ..and so on... ]

Find a Process Listening on a Specific Port

lsof -i | grep ':5938 (LISTEN)'
Google    43523 myuser  239u  IPv4 0x45ba6555dc039ab1      0t0  TCP localhost:5938 (LISTEN)


The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.