6. Networking from the shell
One-liner. Five commands cover 90% of host-network debugging.
Memorize
ip a/ip r— addresses and routes (replacesifconfig/route).ss -tulpn— listening sockets + owning process (replacesnetstat).dig +short,dig +trace,resolvectl query— DNS path and answers.tcpdump -i any -nn 'port 443'— capture;-w file.pcapfor Wireshark.curl -w '@timing.txt' -o /dev/null -s https://host— DNS/TCP/TLS/TTFB breakdown.nft list ruleset/iptables -S— firewall truth, not the cloud console.- Network namespaces (
ip netns) are how containers get isolated stacks.
Trap. Trusting ping — ICMP can be blocked while TCP works fine (and vice versa). Do this. Test the actual protocol and port you care about.
Check
Which command shows which process is listening on TCP port 8080?
Why
-t TCP, -u UDP, -l listening, -p process, -n numeric — the standard one-liner.