Linux Networking & Troubleshooting Commands Cheat Sheet (ip, ss, tcpdump, dig)
Searchable 1-click copy command sheet covering iproute2 (`ip`, `ss`), DNS (`dig`, `resolvectl`), `tcpdump`, `nc`, `curl`, `journalctl`, and `nftables`/`ufw`.
Exam Code: Linux+ · CKA · SRE | Track: Networking & Infrastructure | Recommended Course: CompTIA Linux+ (XK0-005) & Server Troubleshooting Bootcamp
Interface Inspection, Routing & Live Socket Diagnostics
Modern iproute2 commands tested in CompTIA Linux+, Network+, Kubernetes CKA, and cloud SRE interviews.
| Objective | Modern Linux Command | Legacy Replacement / Note |
|---|---|---|
List IPv4/IPv6 interface addresses | ip -br a | Replaces deprecated ifconfig |
Inspect routing table & default gateway | ip route show | Check src IP & metric priority (replaces route -n) |
Check listening TCP/UDP ports + PIDs | sudo ss -tulnp | Faster replacement for deprecated netstat -tulnp |
Inspect local ARP / Neighbor MAC table | ip neigh show | Verify Layer 2 reachability on local subnet |
Trace DNS resolution path step-by-step | dig +trace learnify-solutions.com | Verify authoritative NS & A/AAAA records cleanly |
Test HTTPS TLS handshake & headers | curl -Iv https://example.com | Inspect HTTP status, TLS version & cert expiry |
Verify open remote TCP port via nc | nc -zv 10.0.1.25 5432 | Tests firewall / NSG reachability cleanly |
Packet Capture (tcpdump), Firewalls & Service Logs
Essential root-cause commands for production incident triage.
| Objective | Linux CLI Command | Operational Tip |
|---|---|---|
Capture port 443 traffic to PCAP file | sudo tcpdump -i eth0 port 443 -nn -w capture.pcap | -nn skips DNS lookup so capture never drops packets |
Combine live packet read on ICMP/DNS | sudo tcpdump -i any -nn icmp or port 53 | Great for verifying asymmetric routing or DNS failures |
Tail systemd service errors in real time | sudo journalctl -u nginx -f --since "15 minutes ago" | Instant visibility into crashed daemons |
Inspect active firewalld rules | sudo firewall-cmd --list-all | RHEL / Rocky Linux firewall verification |
Inspect UFW firewall rules on Ubuntu | sudo ufw status verbose | Verify allowed ingress ports and default policy |
Show top memory/CPU consuming processes | ps aux --sort=-%mem | head -n 15 | Quickly isolates OOM candidates before CKA node drains |
Frequently Asked Questions
Why should candidates use `ip` and `ss` instead of `ifconfig` and `netstat` in 2026?
Modern Enterprise Linux distributions (Ubuntu 24.04, RHEL 9) ship `iproute2` by default, where `ss -tulnp` executes significantly faster on busy nodes and displays kernel socket buffers cleanly.