ss / netstat Flags & Options
Inspect sockets and listening ports.All ss / netstat pages
- ss -H (--no-header): drop the header line when counting or parsing socketsss -H drops the header line so ss output can be counted with wc -l or parsed with awk. Column shifts with state filters and one-line output with -O explained.
- ss -K: close a TCP connection without killing the processss -K forcibly closes matching TCP sockets without killing the process, so the app sees a reset. Needs root and kernel socket-destroy support; preview first.
- ss -o: show TCP timers (retransmit, keepalive, timewait) per connectionss -o shows TCP timers per connection: retransmit (on), keepalive, timewait and persist, with expiry and retransmissions. Check keepalive and stuck sockets.
- ss -p: show which process owns a socket (and why it is empty without root)ss -p shows which process and PID owns each socket, as in sudo ss -ltnp for listening ports. Without root, other users' processes are silently left out.