ss flags & options
-t
Show TCP sockets only.
ss -t
-u
Show UDP sockets only.
ss -u
-l
Show only listening sockets.
ss -l
ss -lt
-n
Show numeric addresses and ports instead of resolving names.
ss -n
-p
Show the process using each socket.
sudo ss -p
sudo ss -tlnp
-a
Show all sockets (listening and non-listening).
ss -a
ss -ta
-s
Print summary statistics.
ss -s
-tulnp
Common combo: show all listening TCP/UDP sockets with process info.
sudo ss -tulnp
state
Filter sockets by connection state.
ss state established
ss -t state time-wait