Let's be honest when your production server goes down at 3 AM, you don't have time to Google "how to debug network issues." You need to know these commands like the back of your hand.

I've been there, frantically troubleshooting connectivity issues while stakeholders breathe down my neck. After years in the trenches, here are the 20 networking commands that have saved my bacon more times than I can count.

The Connection Checkers

1. ping Your First Line of Defense

ping google.com
ping -c 4 192.168.1.1

The classic. If ping fails, you know the network path is broken. The -c flag limits the count so you're not sitting there watching packets forever. It's simple, but it tells you immediately if you can reach the destination.

2. traceroute Where Did My Packets Go?

traceroute google.com

When ping fails, traceroute shows you exactly where along the path things went wrong. Each hop represents a router your packet traversed. If you see asterisks or timeouts at a specific hop, you've found your culprit.

3. mtr Traceroute's Cooler Cousin

mtr google.com

Think of mtr as traceroute on steroids. It combines ping and traceroute, continuously updating with packet loss statistics. Perfect for spotting intermittent network issues that traditional tools might miss.

DNS Troubleshooting

4. dig The DNS Swiss Army Knife

dig example.com
dig @8.8.8.8 example.com
dig example.com +short

Dig is your go-to for DNS troubleshooting. The @ syntax lets you query specific DNS servers, and +short gives you just the IP without the noise. When DNS is acting weird, dig tells you why.

5. nslookup The Old Reliable

nslookup example.com

Less powerful than dig but simpler for quick lookups. Some old-school admins swear by it. I use dig, but nslookup gets the job done when you just need a quick DNS resolution check.

6. host Quick and Dirty DNS

host example.com
host -a example.com

Even simpler than nslookup. The -a flag shows you all DNS record types. Great for scripting because the output is cleaner and easier to parse.

Network Configuration

7. ifconfig Know Your Network Interface

ifconfig
ifconfig eth0

Shows your network interfaces, IP addresses, MAC addresses, and statistics. Yes, it's being replaced by ip, but it's still everywhere and the syntax is more intuitive for beginners.

8. ip The Modern Way

ip addr show
ip route show
ip link set eth0 up

The newer, more powerful replacement for ifconfig. If you're serious about Linux networking, learn this one. It handles addresses, routes, and links all in one command.

9. iwconfig For Wireless Networks

iwconfig wlan0

Like ifconfig but specifically for wireless interfaces. Shows signal strength, frequency, encryption status , everything you need when Wi-Fi is being flaky.

Port and Connection Management

10. netstat What's Actually Connected?

netstat -tulpn
netstat -an | grep ESTABLISHED

Shows all active connections, listening ports, and routing tables. The -tulpn flags show TCP/UDP listening ports with program names. Essential for security audits and debugging what's actually running.

11. ss Netstat's Faster Replacement

ss -tulpn
ss -s

Does everything netstat does but faster. Modern systems are moving toward ss because it leverages kernel data structures more efficiently. Same flags, better performance.

12. nmap The Network Scanner

nmap 192.168.1.0/24
nmap -sV localhost

The legendary port scanner. Discovers hosts, scans open ports, detects services and versions. Every pentester's favorite tool, but also invaluable for legitimate network mapping and security auditing.

13. lsof What Files Are Open?

lsof -i :80
lsof -i TCP

Lists open files, including network connections. The -i flag filters for internet connections. Perfect for finding which process is hogging port 80 when you're trying to start your web server.

Traffic Analysis

14. tcpdump Capture Everything

tcpdump -i eth0
tcpdump -i any port 80 -w capture.pcap

The ultimate packet sniffer. Captures raw network traffic for deep analysis. The -w flag writes to a file that you can open in Wireshark later. When weird stuff happens, tcpdump shows you exactly what's going over the wire.

15. iftop Real-Time Bandwidth Monitor

iftop -i eth0

Shows bandwidth usage by connection in real-time. It's like top but for network traffic. When something is maxing out your bandwidth, iftop tells you what.

16. wget Download and Test

wget http://example.com/file.zip
wget --spider http://example.com

Everyone knows wget downloads files, but it's also perfect for testing HTTP connectivity and troubleshooting web servers. The --spider flag checks if a URL exists without downloading.

17. curl The HTTP Testing Powerhouse

curl -I http://example.com
curl -X POST -d "key=value" http://api.example.com

More versatile than wget. Tests APIs, checks headers, supports every HTTP method imaginable. If you work with web services, curl is indispensable.

Advanced Tools

18. arp Who's on My Local Network?

arp -a
arp -d 192.168.1.100

Shows the ARP table mapping IP addresses to MAC addresses. Useful for detecting ARP spoofing attacks or finding devices on your local network.

19. route Where Do Packets Go?

route -n
route add default gw 192.168.1.1

Displays and manipulates the routing table. When packets aren't reaching their destination, the routing table is often the problem. The -n flag shows numerical addresses instead of trying to resolve hostnames.

20. hostname Who Am I?

hostname
hostname -I

Simple but essential. Shows your system's hostname and IP addresses. The -I flag displays all network addresses. Great for scripting and quick identity checks.

The Underrated Heroes

Bonus: iperf Test Network Performance

# On server
iperf -s

# On client
iperf -c server_ip

Measures maximum TCP/UDP bandwidth between two hosts. Perfect for baseline testing when you suspect network performance issues.

Bonus: ethtool Hardware-Level Diagnostics

ethtool eth0
ethtool -S eth0

Shows detailed driver information, statistics, and diagnostics. When you need to verify link speed, duplex settings, or troubleshoot at the hardware level.

Real-World Debugging Flow

Here's how I actually use these tools when something breaks:

  1. ping Can I reach the destination?
  2. tracerouteWhere's it failing?
  3. digIs DNS working?
  4. netstat/ssWhat's listening and connected?
  5. tcpdump What's actually happening on the wire?

This sequence solves 90% of network issues I encounter.

The Truth About Networking Commands

You don't need to memorize all these commands immediately. Start with the basics: ping, netstat, and ifconfig. As you encounter different problems, your toolkit will naturally expand.

But when that production outage hits, you'll be glad you invested time learning these tools. The difference between an engineer who knows their networking commands and one who doesn't? About three hours of downtime.

Keep this list bookmarked. Your future self will thank you when the network inevitably goes sideways at the worst possible moment.

Now get out there and debug some network issues!