ss vs netstat: the translated runbook
netstat is legacy on modern Linux; ss replaces it flag for flag. The full mapping, the port-8080 hunt in one line, and the cases where netstat still wins.
ss vs netstat: on modern Linux, ss is the standard, netstat legacy — often not installed. The flags map one to one: netstat -tlpn → ss -tlpn. Port hunt in one line: sudo ss -ltnp 'sport = :8080' — process name and PID come straight back.
ss vs netstat: the translated runbook
| What you want | The old line | The new line |
|---|---|---|
| listening TCP + process | netstat -tlpn | ss -tlpn |
| all TCP + UDP connections | netstat -tulpna | ss -tulpna |
| routing table | netstat -r | ip route |
| interface statistics | netstat -i | ip -s link |
| kernel socket summary | — no netstat answer — | ss -s |
| filter by port, in-kernel | grep-and-pray | ss -tnp 'sport = :22' |
The first two rows are identical: ss's short flags line up with netstat's for the common cases, so muscle memory mostly survives the move. Routing and interfaces moved to iproute2's ip route and ip -s link.
Is netstat deprecated?
On Linux, effectively yes. net-tools — netstat, ifconfig, route — no longer installs by default on any major distro. New features land only in iproute2, behind ss and ip.
- Missing on fresh installs. A default Ubuntu 24.04 or Fedora server has no
netstatuntil you installnet-toolsby hand — which is why "the netstat equivalent" gets searched at all. - No modern socket info. netstat predates TCP fast open, subflow-level socket stats and cgroup socket attribution.
ssreports them natively. - The Windows exception. On Windows,
netstat -anois still the standard way to map a PID to a listening port. Only the Linux story is deprecation.
The workhorse, flag by flag
ss means socket statistics — the kernel's view of every TCP, UDP and Unix socket.
# everything listening, with the owning process sudo ss -tulpn # established connections to/from port 443, with processes sudo ss -tnp 'sport = :443 or dport = :443' # how many sockets in each state ss -s
TCP (-t), UDP (-u), listening only (-l), show processes (-p), numeric output / no DNS lookups (-n). sudo matters for -p: without root you see ports but no process names for sockets you don't own. The filter runs inside the kernel — exact, not text-matched. That's the upgrade over grep-and-pray.
Who owns port 8080?
one line — sudo ss -ltnp 'sport = :8080' — and the process name and PID come straight back.
State Recv-Q Send-Q Local Address:Port Peer Address:Port ProcessLISTEN 0 511 *:8080 *:* users:(("node",pid=214113,fd=18))
The users:(...) field gives process name and PID directly — no second command. Port busy but no process? Usually a socket in another network namespace — a container; from the host the process column is empty, so match with docker ps or nsenter. sudo lsof -i :8080 -sTCP:LISTEN does the same job and works on macOS and most BSDs. Verify: the same command → users:(("node",pid=…)); swap in any port 1–65535.
Why is ss not found?
Either a pre-2007-era distro, or — far more likely — not Linux at all.
macOS ships lsof and netstat but no ss; same for the BSDs mostly. On Windows: netstat -ano or PowerShell's Get-NetTCPConnection. Genuinely Linux and missing: install iproute2 — sudo apt install iproute2 (Debian/Ubuntu) or sudo dnf install iproute2 (Fedora/RHEL). Verify: ss -V → a version string on the first line.
When netstat still earns its row
Two honest cases: portability across a mixed Linux, AIX or older-BSD fleet, and muscle-memory continuity in old runbooks. Otherwise default to ss and update the runbook.
ss on Linux. Keep netstat for mixed-fleet portability and runbooks that still have net-tools installed.- tested on Ubuntu 24.04 · Fedora · Debian · iproute2 ss · Windows netstat -ano
- first published 2026-09-05; record refreshed 2026-10-04
- the sample ss -ltnp output is a real capture from a dev-server box — a node process on :8080 — retyped, not invented