π οΈ Essential Networking Commands Cheat Sheet for DevOps

If you're trying to debug why your server isn't responding, or why a DNS record isn't resolving, or if your app just randomly hangs β these are the commands youβll turn to.
So here it is β a quick but powerful guide to the most used networking commands every DevOps learner (or practitioner) should know.
1. π§ ping
β Check If a Host Is Reachable
ping.google.com
What it does:
Sends ICMP echo requests to a target host to check if itβs alive and how long it takes to respond.
When to use:
Check internet connection
Test server uptime or response
Quick network diagnosis
πΉ Sample Output:
64 bytes from 142.250.183.14: icmp_seq=1 ttl=115 time=25.3 ms
2. πΊοΈ traceroute
(Linux/macOS) / tracert
(Windows) β Trace the Route to a Host
traceroute github.com #Linux/macOS
tracert github.com #Windows
What it does:
Shows the route (hops) your request takes through the internet to reach the destination.
When to use:
Find where a connection is slowing down or breaking
See how many hops are between your machine and the server
πΉ Useful when ping
works, but your app is still slow or stuck.
3. π curl
β Make HTTP Requests from Terminal
curl -I https://example.com #Get only headers
curl -X GET https://api.site.com/data
What it does:
Interacts with web servers, APIs, and endpoints directly from the command line.
When to use:
Test API endpoints
Check HTTP headers or response codes
Simulate GET/POST requests
πΉ Try this to check if a website is up:
curl -Is https://yourdomain.com | head -n 1
4. π°οΈ netstat
β Show Network Connections and Listening Ports
netstat -tuln
What it does:
Displays current network connections, listening ports, and routing tables.
When to use:
Check which ports are open and which service is using them
Debug port conflicts
See if your app/server is listening
πΉ Common flags:
-t
β TCP-u
β UDP-l
β Listening-n
β Show numbers (no DNS resolution)
5. π dig
β DNS Lookup (Linux/macOS)
dig google.com
What it does:
Performs detailed DNS queries and shows how domain names are resolved.
When to use:
Check DNS propagation
Validate custom DNS records (A, CNAME, TXT, etc.)
Diagnose DNS-related errors
πΉ To check just the A record:
dig +short google.com
6. π΅οΈββοΈ nslookup
β DNS Lookup (Cross-Platform Alternative)
nslookup github.com
What it does:
Resolves domain names to IP addresses β works on Linux, macOS, and Windows.
When to use:
Quick domain-to-IP checks
Cross-check DNS if
dig
isnβt available
Bonus: Combining Commands
ping -c 3 google.com && curl -I https://google.com
Test both connectivity and web response in one go.
β Quick Reference Summary Table
Command | Purpose | Example |
ping | Check if host is reachable | ping google.com |
traceroute / tracert | Trace network route | traceroute github.com |
curl | Make HTTP requests | curl -I example.com |
netstat | View ports & connections | netstat -tuln |
dig | DNS record lookup | dig yourdomain.com |
nslookup | DNS resolver (alt) | nslookup google.com |
π§ What I Learned
Honestly, using these commands helped me understand networking more than any theory ever did. Once you practice a few real-life debugging cases β slow websites, DNS misconfigurations, SSL issues β these tools become second nature.
π Final Tip
Always start with:
ping β dig β netstat
This flow helps you identify:
Is the server up?
Is the service running?
Is DNS working?
Is the port open?
Subscribe to my newsletter
Read articles from Abhishek Negi directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
