πŸ› οΈ Essential Networking Commands Cheat Sheet for DevOps

Abhishek NegiAbhishek Negi
3 min read

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

CommandPurposeExample
pingCheck if host is reachableping google.com
traceroute / tracertTrace network routetraceroute github.com
curlMake HTTP requestscurl -I example.com
netstatView ports & connectionsnetstat -tuln
digDNS record lookupdig yourdomain.com
nslookupDNS 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?

0
Subscribe to my newsletter

Read articles from Abhishek Negi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Abhishek Negi
Abhishek Negi