← Knowledge Base
NetworkingReference note1 min read · updated 2026-11-27

Which program is listening on a port: ss and lsof

List listening sockets, connections and the owning processes.

ssportssockets
sudo ss -tlnp               # TCP listeners with process names (-t tcp, -l listening, -n numeric, -p process)
sudo ss -ulnp               # UDP listeners
ss -tn state established    # active TCP connections
ss -s                       # summary
sudo lsof -i :443           # who uses port 443
sudo lsof -iTCP -sTCP:LISTEN -P -n

0.0.0.0:80 or [::]:80 means "all interfaces"; 127.0.0.1:5432 is local only. Compare this list with your firewall: every public listener is attack surface. If a service starts but is unreachable, check that it listens on the right address, that the firewall allows it, and (in the cloud) that the provider's security group allows it too.