Skip to content

Did you know?

ss -tulpn shows every listening port and the program behind it.

It replaces netstat, which many distributions no longer install.

Explained

Which program is using port 80? Is MySQL listening on all interfaces or only on localhost? ss answers both:

sudo ss -tulpn
Netid State  Local Address:Port  Peer Address:Port Process
tcp   LISTEN 0.0.0.0:80          0.0.0.0:*         users:(("nginx",pid=812,fd=6))
tcp   LISTEN 127.0.0.1:3306      0.0.0.0:*         users:(("mariadbd",pid=655,fd=21))

The options: -t TCP, -u UDP, -l listening sockets only, -p show the process (needs sudo for other users’ processes) and -n numeric ports instead of service names.

An address of 0.0.0.0 or [::] means the port is open on every interface; 127.0.0.1 means local connections only. Filter for one port:

sudo ss -tlnp 'sport = :443'

ss is part of iproute2 and installed everywhere. The older netstat comes from the net-tools package, which most distributions no longer install by default.

Learn more

← All tech tips · Suggest a fix

Back to top