List listening ports on Linux

Show all TCP/UDP sockets that are listening, with the owning process.

LinuxDiagnosticsProcessesLow risk
Run the command below. It prints every listening TCP and UDP socket with local address, port and process name. Prefix with sudo to see process names for sockets owned by other users.

01Command

Command
$ ss -tulpn

02What it does

ss is the modern iproute2 replacement for netstat and is installed by default on most distributions. -t TCP, -u UDP, -l listening only, -p show processes, -n numeric ports. Use it to find which service occupies a port before changing configs.

03Risk

RiskLow risk
Requirementssudo for process names of other users' sockets
CompatibilityLinux with iproute2 (Debian/Ubuntu, RHEL, Arch 等)
!Warning: Only act on processes you recognize; system services legitimately listen on many ports.

04Undo

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

05Sources

Last verified: 2025-11-21 · Category: Network

06Related solutions