Network CLI Toolkit
Diagnose DNS, connections, and packets from the terminal — dig, ss, tcpdump, ip, and nc, with the flags that get answers fast.
DNS (dig)
- Resolve a name
dig example.com +short- Specific record
dig example.com MX +short(A/AAAA/MX/TXT/NS/CNAME)- Use a resolver
dig @1.1.1.1 example.com- Trace delegation
dig +trace example.com— root → TLD → authoritative- Reverse lookup
dig -x 8.8.8.8 +short
Connections & ports (ss)
- Listening TCP + PID
ss -ltnp- All established
ss -tn state established- By port
ss -tnp 'sport = :443'- Socket summary
ss -s— counts by state- Is a host reachable?
nc -vz host 443— TCP connect test
Packets (tcpdump)
- Capture on interface
tcpdump -i eth0 -nn(-nn= no name/port resolve)- Filter host + port
tcpdump -i any host 10.0.0.5 and port 80- Write / read pcap
tcpdump -w cap.pcap· open in Wireshark- See payloads
tcpdump -A -nn port 80(ASCII)
Interfaces & routes (ip)
- Addresses
ip -br a(brief)- Routing table
ip route· default gateway shown first- Which route to a host
ip route get 8.8.8.8- Path to host
mtr example.com(live traceroute + loss)