ss

Find out which ports are open and who listens on them

What it does

ss shows network connections. -tlnp answers the common question "who took this port": TCP (-t), only those waiting for connections (-l), ports as numbers (-n), and the program holding them (-p; other users' programs are shown only with sudo).

In the address column, 0.0.0.0:80 means the port is open on every interface, and 127.0.0.1:5432 only to the machine itself. To check one port, add | grep :80. ss replaced netstat, and their flags are nearly the same.

Syntax

sudo ss -tlnp
sudo ss -tlnp | grep :<port>

Examples

Related commands

Practise · All commands