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
Find out which programs listen on TCP ports
sudo ss -tlnpsame as:
sudo ss -ltnp,sudo ss -tnlp,sudo ss -lntp,sudo ss -plntss— network sockets-t— TCP only-l— listening ports only-n— ports as numbers, not names-p— which process; with sudo, everyone's