For senior engineers, the ability to diagnose network issues directly from the command line is a critical skill. While monitoring dashboards provide high-level overviews, CLI tools offer the granularity needed to identify the root cause of connectivity failures, latency spikes, or misconfigurations.
1. Connectivity & Path Analysis: ping, traceroute, mtr
ping is the most basic tool for testing reachability using ICMP Echo Requests. It measures Round-Trip Time (RTT) and packet loss.
traceroute maps the path packets take to a destination by manipulating the IP Time-To-Live (TTL) field. mtr (My Traceroute) combines ping and traceroute into a real-time diagnostic tool.
2. Socket Statistics: ss & netstat
While netstat is deprecated, ss is the modern standard for dumping socket statistics. It is faster and provides more detailed TCP information.
3. DNS Diagnostics: dig & nslookup
dig (Domain Information Groper) is preferred over nslookup for its verbose output and flexibility in querying specific DNS records.
4. Application Layer & Raw Connectivity: curl, nc, openssl
curl is essential for debugging HTTP/S. nc (netcat) acts as a raw TCP/UDP tool.
netcat (nc) is the "Swiss Army knife" for networking.
openssl is crucial for debugging HTTPS/TLS certificate chains.