Interview Prep/Networking/Performance, MTU, Latency & Tools

How do you check what is listening on a port and who is connected?

BeginnerScenarioPerformance, MTU, Latency & Tools
Answer

Situation read → Everyday server diagnosis.

What I'd do →

  1. ss -tulpn lists listening TCP and UDP sockets with process names
  2. ss -tn state established '( dport = :443 )' shows active connections
  3. lsof -i :8080 shows the owning process
  4. From another host use nc -zv host 8080 or curl -v telnet://host:8080
  5. netstat is deprecated in favour of ss

Why → ss reads kernel socket tables directly and is faster than netstat.

Interview tip → Say listening on 127.0.0.1 versus 0.0.0.0 is the first thing to read.

All Networking questions Roadmap: Networking for DevOps

More on Performance, MTU, Latency & Tools