Inspect open sockets with ss

See which services listen on which ports and who is connected — the modern netstat replacement.

LinuxProcessesnetworkportsnetstatMedium risk
Run sudo ss -tulpn to list all listening TCP and UDP sockets with the owning process, or ss -tn state established for live connections.

01Command

Command
$ sudo ss -tulpn

02What it does

ss talks to the kernel directly via netlink, so it is faster and more complete than netstat on current kernels and shows states like TIME-WAIT in bulk. -t/-u select TCP/UDP, -l limits to listening sockets, -n keeps port numbers un-translated, and -p reveals the process behind each socket. You can filter precisely, e.g. ss -tn 'dport = :443'.

03Risk

RiskMedium risk
Requirementsiproute2 package (preinstalled on all mainstream distros); -p process info needs root to see other users' processes.
!Warning: Without sudo, -p only shows your own processes, so ports may look orphaned. A listening socket on 0.0.0.0 faces the whole network — cross-check surprising listeners with your firewall before exposing anything.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • ss(8) — Arch Manual Pages
    Arch Linux · community · 2026-09-17
    Evidence: Same options documented for ss, another utility to investigate sockets.
  • ss(8) — Debian bookworm
    Debian Manpages · community · 2026-09-17
    Evidence: Documents -t/--tcp, -u/--udp, -l/--listening, -p/--processes and -n/--numeric for the socket statistics tool.

Last verified: 2026-09-19 · Category: Network

06Related solutions