ss Cheat Sheet

Socket statistics — listening ports, established connections, and who owns each socket. The modern netstat.

Networking3 sections · 15 commands
⌘K

Listening Sockets

5
ss -tlnp

Listening TCP sockets + owning process

ss -ulnp

Listening UDP sockets

ss -tulnp

TCP and UDP together

ss -tlnp sport = :443

Who is on port 443

ss -tlnp | grep :8080

Grep for a port

Connections & State

6
ss -tn

All TCP connections (numeric)

ss -tn state established

Only established links

ss -tn state time-wait

Sockets in TIME_WAIT

ss -o

Add connection timers

ss -tan | awk '{print $1}' | sort | uniq -c

Count of each TCP state

ss -i

Per-socket internal info (cwnd, rtt)

Stats & Domain

4
ss -s

Connection counts by state

ss -x

Unix domain sockets

ss -x dst /var/run/docker.sock

Sockets connected to a socket file

ss -l

All listening sockets