ss Inspect sockets
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
ss -tulpnss -tnss -ltn 'sport = :<port>'
ss -sss -tnp state established
ss -tn dst <ip>
ss -tiss -lxConcepts
- Socket type -t -u -x -4 -6
- State filter state established
- Address filter sport = :443
- Output columns + extras
Select sockets
ss -tss -uss -xss -lss -ass -4 / ss -6ss -wss -0ss -A <type>,<type>
ss -f <family>
ss --vsockOutput control
ss -nss -pss -rss -Hss -Oss -Qss -ess -oss -mss -iss -Tss -Zss --cgroupss -sFilter by state
ss -t state established
ss -t state listening
ss -t state time-wait
ss -t state close-wait
ss -t state syn-recv
ss -t state connected
ss -t exclude <state>
ss -t state bucket
Filter by address
ss -tn 'sport = :<port>'
ss -tn 'dport = :<port>'
ss -tn dst <ip>
ss -tn src <ip>
ss -tn dst <net>/<mask>
ss -tn dst <ip>:<port>
ss -tn 'sport > :1024'
ss -tn '( sport = :80 or sport = :443 )'
ss -tn 'dport = :ssh'
ss -x src <path>
ss -tn dev <iface>
ss -tn fwmark <mark>
ss -tn autobound
Advanced
ss -Ess -K <filter>
ss -N <netns>
ss -Bss --inet-sockopt
ss -bss -D <file>
ss -F <file>
Reading the table
| Column | Meaning |
|---|---|
Netid |
Socket type: tcp, udp, u_str |
State |
LISTEN, ESTAB, TIME-WAIT... |
Recv-Q |
Bytes not yet read by the app |
Send-Q |
Bytes not yet acked by the peer |
Local Address:Port |
This end of the socket |
Peer Address:Port |
Remote end; * if none |
Process |
users:((name,pid,fd)) with -p |
| Column | Means |
|---|---|
Recv-Q |
Connections waiting for accept() |
Send-Q |
Configured backlog size |
Recipes
sudo ss -ltnp 'sport = :8080'# no output means nothing is listening
ss -tanH | awk '{print $1}' | sort | uniq -c | sort -rn
ss -tnH state established | awk '{print $4}' \ | cut -d: -f1 | sort | uniq -c | sort -rn | head
watch -n 1 'ss -tulpn'# slow connection: ss -ti dst <ip>



