To find what is listening on a TCP/IP port, open a terminal and go to a shell command-line, and use lsof
, a command that LiSts Open Files (TCP ports are considered a type of file in UNIX).
This checks all listening ports:
$ sudo lsof -nP -iTCP -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
influxd 680 influxdb 3u IPv6 13892 0t0 TCP 127.0.0.1:8088 (LISTEN)
influxd 680 influxdb 21u IPv6 17019 0t0 TCP 127.0.0.1:8086 (LISTEN)
postgres 888 postgres 6u IPv4 16842 0t0 TCP 127.0.0.1:5432 (LISTEN)
jupyter-n 2351 rjohns 6u IPv4 22752 0t0 TCP 127.0.0.1:8888 (LISTEN)
...
The following check is specific to port 5432:
$ sudo lsof -nP -iTCP:5432 -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
postgres 888 postgres 6u IPv4 16842 0t0 TCP 127.0.0.1:5432 (LISTEN)
These commands work for most Linux flavors.
Blog: Cloudy with a Chance of TCP Drops
Network Data: Key Concepts
Network Performance Monitoring
Corvil for IT Operations Analytics