James's Ramblings

ss

Created: January 06, 2025

Replaced netstat in newer Linux distributions.

List sockets that aren’t listening

ss

List listening sockets as well

ss -l

List both listening and non-listening sockets

ss -a

List all sockets and processes using them

ss -a -p

List all TCP sockets

ss -a -t

List all UDP sockets

ss -a -u

List all UNIX sockets

ss -a -x

List all raw sockets

ss -a -w

List all IPv4 sockets

ss -a -4

List all IPv6 sockets

ss -a -6

List TCP sockets with a specific state

ss -t -r state STATE

List all connections to an IP

ss -a dst IP

List all connections with a specific protocol

ss -a '( dport = :PROTO or sport = :PROTO )'

List all connections but do not resolve hostnames

ss -a -n