Network
ss
Inspect network sockets and listening ports.
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 because it reads kernel data directly.
The most common check is "what is listening on my machine?" followed by "which process owns that port?".
Syntax
ss [options] [filter]
Parameters
options: Flags that change whatssreports.filter: Optional state or address filter, such asstate established.
Common Options
-t: TCP sockets.-u: UDP sockets.-l: Listening (server) sockets only.-a: Show listening and non-listening sockets.-n: Numeric addresses and ports (no DNS or service-name lookup).-r: Try to resolve hostnames.-p: Show the owning process and PID (needs privileges).-s: Show a socket summary by state.-4/-6: Limit to IPv4 or IPv6 sockets.-o: Show timers such as TCP keepalive state.-i: Show internal TCP information.
Examples
ss -tuln
Show all listening TCP and UDP ports numerically.
sudo ss -tulnp
Show listening ports together with process names and PIDs.
ss -tan
Show every TCP socket numerically, including established connections.
ss -tunp state established
Show only established TCP and UDP connections with processes.
ss -tlnp '( sport = :443 )'
Show listeners on port 443 only.
ss -s
Print a summary count of sockets by state.
ss -tn dst 10.0.0.5
Show TCP sockets whose destination is 10.0.0.5.
Practical Notes
- Use
sudowith-pwhen process names are hidden or shown as-. 127.0.0.1:PORTlistens only on the loopback interface;0.0.0.0:PORTlistens on all IPv4 interfaces.- Add
-4or-6to limit noise on dual-stack hosts. - After finding a service port, use
systemctl status SERVICEto manage it. ss -tulnis one of the quickest port-inspection commands on modern Linux.