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.

ObjectiveModern Linux CommandLegacy Replacement / Note
List IPv4/IPv6 interface addressesip -br aReplaces deprecated ifconfig
Inspect routing table & default gatewayip route showCheck src IP & metric priority (replaces route -n)
Check listening TCP/UDP ports + PIDssudo ss -tulnpFaster replacement for deprecated netstat -tulnp
Inspect local ARP / Neighbor MAC tableip neigh showVerify Layer 2 reachability on local subnet
Trace DNS resolution path step-by-stepdig +trace learnify-solutions.comVerify authoritative NS & A/AAAA records cleanly
Test HTTPS TLS handshake & headerscurl -Iv https://example.comInspect HTTP status, TLS version & cert expiry
Verify open remote TCP port via ncnc -zv 10.0.1.25 5432Tests firewall / NSG reachability cleanly

Packet Capture (tcpdump), Firewalls & Service Logs

Essential root-cause commands for production incident triage.

ObjectiveLinux CLI CommandOperational Tip
Capture port 443 traffic to PCAP filesudo tcpdump -i eth0 port 443 -nn -w capture.pcap-nn skips DNS lookup so capture never drops packets
Combine live packet read on ICMP/DNSsudo tcpdump -i any -nn icmp or port 53Great for verifying asymmetric routing or DNS failures
Tail systemd service errors in real timesudo journalctl -u nginx -f --since "15 minutes ago"Instant visibility into crashed daemons
Inspect active firewalld rulessudo firewall-cmd --list-allRHEL / Rocky Linux firewall verification
Inspect UFW firewall rules on Ubuntusudo ufw status verboseVerify allowed ingress ports and default policy
Show top memory/CPU consuming processesps aux --sort=-%mem | head -n 15Quickly 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.