Interview Prep/Networking/Command-Line Tools & Diagnostics

How do you list listening ports and the processes that own them?

BeginnerConceptCommand-Line Tools & Diagnostics
Answer
ss -tulpn          # TCP+UDP, listening, numeric, with process
ss -tlnp 'sport = :443'
lsof -iTCP:8080 -sTCP:LISTEN

ss replaced netstat and reads from netlink directly, so it is much faster on hosts with many sockets. Run it with sudo to see process names for other users.

All Networking questions Roadmap: Networking for DevOps

More on Command-Line Tools & Diagnostics