ss(8)
Display socket statistics and network connection information, replacing the deprecated netstat command.
Synopsis
ss [OPTION]... [FILTER]Description
The ss command shows socket statistics for TCP, UDP, and other protocols. It's faster and more detailed than netstat, using information from the kernel's /proc filesystem. Use it to diagnose network connections, listening ports, and socket states.
Filters can be applied by protocol (tcp, udp, raw), state (ESTABLISHED, LISTEN), or address:port combinations. Output includes local/remote addresses, port numbers, and connection states.
Common options
| Flag | What it does |
|---|---|
-t | Show TCP sockets only |
-u | Show UDP sockets only |
-l | Display listening sockets |
-a | Show all sockets (listening and established) |
-p | Show process name and PID associated with each socket |
-n | Don't resolve service names; display numeric port numbers |
-e | Show detailed socket information (extended) |
-i | Show TCP internal information (RTT, advmss, etc.) |
-m | Show socket memory usage |
-o | Show timer information (retransmit timers, keepalive) |
-s | Show summary statistics instead of listing sockets |
-4 | Show IPv4 sockets only |
Examples
List all TCP listening sockets with numeric ports and process information
ss -tlnpShow all listening TCP and UDP sockets with processes and numeric output
ss -tulnpDisplay all established TCP connections in numeric format
ss -tan | grep ESTABLISHEDFind which process is listening on port 8080
ss -plnt dst :8080Show summary statistics for all socket types
ss -sList established TCP connections with internal info (RTT, window size)
ss -tni state establishedShow UDP sockets related to DNS port 53
ss -u | grep :53Display all TCP sockets with memory usage information
ss -tam