Network
ss
Inspect network sockets and listening ports.
networksocketportlisteningtcpudp
Additional Notes
ss shows socket information: listening ports, established connections, TCP/UDP state, and process ownership when permitted.
It is the modern replacement for many netstat use cases and is usually faster.
Syntax
ss [options]
Parameters
options: Flags that change howssbehaves.
Common Options
-t: TCP sockets.-u: UDP sockets.-l: Listening sockets.-n: Numeric addresses and ports.-p: Show process information.-a: Show listening and non-listening sockets.-r: Resolve hostnames.-s: Show socket summary.
Examples
ss -tuln
Show listening TCP and UDP ports numerically.
sudo ss -tulnp
Show listening ports with process names.
ss -tan
Show all TCP sockets numerically.
ss -s
Show socket summary.
ss -tn state established
Show established TCP connections.
Practical Notes
- Use
sudowith-pwhen process names are hidden. 127.0.0.1:PORTlistens only locally;0.0.0.0:PORTlistens on all IPv4 interfaces.- Use
systemctl status serviceafter identifying a service port. ss -tulnis one of the quickest port-inspection commands on modern Linux.