Ping
The ping
command tests whether your computer can connect to another computer or website on the network (or the internet). It sends small packets of data (ICMP echo messages) to the target website or IP address and waits for a response. If it receives a response, it confirms that the connection is working.
ping google.com
Example:
Think of ping
as calling someone on the phone to check if they’re available. If they answer, you know the connection is good. If they don’t answer, there might be an issue (e.g., their phone is off, or the network is down).
tracert (Windows) or traceroute(Linux / Mac)
The tracert
(Windows) or traceroute
(Linux/macOS) command shows the route your data packets take while traveling from the sender to the receiver. It lists all the intermediate routers (hops) and the time it takes to reach each one. This helps identify where delays or failures occur in the network path.
tracert google.com
Example:
Imagine you’re driving to a friend’s house in another city. tracert
is like using a GPS that shows you every stoplight, intersection, and highway (routers) along the way, as well as how long you spend at each point. If there’s a traffic jam (network delay), you’ll know exactly where it is.
netstat
The netstat
command displays active network connections, listening ports, routing tables, and other network-related statistics. It is primarily used for monitoring and troubleshooting network activity.
netstat
Example:
Think of netstat
as a security guard at a building entrance who keeps a log of everyone entering and exiting, which doors (ports) are open, and who is currently inside. This helps you understand who’s communicating with your system and how.
curl
The curl
command is a CLI (Command Line Interface) tool used to transfer data to or from a server. It supports various protocols like HTTP, HTTPS, FTP, and more. It is commonly used to test APIs, download files, and interact with web servers.
curl www.google.com
Example:
Imagine curl
as a courier who can deliver or fetch packages (data) from a specific address (URL). You tell the courier what to get or send, and they handle the delivery for you.
nslookup / dig
These commands are used to query DNS (Domain Name System) servers to resolve domain names into IP addresses or get other DNS-related information. dig
is more powerful and detailed, while nslookup
is simpler and more interactive.
dig google.com
#or
nslookup google.com
Example:
Think of DNS as a phone book for the internet. When you want to call someone (connect to a website), you look up their name (domain) in the phone book (DNS) to find their phone number (IP address). dig
and nslookup
are like asking the phone book for the number.
Summary Table with Analogies
Command | Purpose | Real-World Analogy |
ping | Check connectivity | Knocking on a door to see if someone’s home |
traceroute | Trace packet routes | Tracking a letter’s journey through post offices |
netstat | Network statistics | A security guard logging who’s in the building |
curl | Make HTTP requests | A courier delivering or fetching packages |
dig /nslookup | DNS lookup | Looking up a phone number in a phone book |
If you like reading articles related to DevOps, Cloud and tech then please make sure to follow me on hashnode