Checking running servers with netstat
AnnexeThis post originally appeared on the Annexe.
A useful set of flags is the delightful “plunt”
# netstat -plunt
For example, on a PostgreSQL box with custom ports:
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 1077/sshd
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 2288/postgres
tcp6 0 0 :::22 :::* LISTEN 1077/sshd
tcp6 0 0 ::1:5432 :::* LISTEN 2288/postgres