ss
stands for "socket statistics" and is a command-line utility for displaying socket and network connection information in Linux. It shows protocol type, state, IP address, ports, and associated processes—quickly and in detail.
ss
is typically preinstalled on modern Linux systems as part of iproute2
. If needed:
sudo apt install iproute2 # Debian / Ubuntu
sudo yum install iproute # CentOS / RHEL
To list all listening TCP/UDP sockets without resolving hostnames:
ss -tuln
Option | Example | |
---|---|---|
-t | Show TCP sockets |
|
-u | Show UDP sockets |
|
-l | Show listening sockets only |
|
-n | Disable hostname resolution |
|
-p | Show process IDs and names |
|
-a | Display all sockets |
|
-s | Display socket summary stats |
|
Find sockets associated with a specific process (e.g., Apache):
ss -lptn | grep apache
List currently active connections:
ss -t -o state established
Check ports listening on localhost:
ss -lt src 127.0.0.1
Feature | netstat | ss |
---|---|---|
Speed and low resource usage | ❌ | ✅ |
IPv6 socket support | ✅ | ✅ |
Process (PID/program) display | ✅ | ✅ |
Default in modern distros | ❌ | ✅ |
sudo ss -p
to see processes bound to portsgrep
to filter specific servicesss
is a fast, modern, and versatile tool for monitoring sockets, listening ports, and active connections in Linux. Its real-time performance, precision, and scripting flexibility make it a must-have for system diagnostics and security audits.