| Tool | Primary Question it Answers | Best For… |
|---|---|---|
ping |
“Are you online and can I reach you?” | Basic connectivity checks |
nslookup |
“What’s the IP address for this domain?” | Quick, simple DNS lookups, especially on Windows |
host |
“What’s the IP/MX record for this domain?” | Clean, easy-to-read DNS lookups |
dig |
“Give me all the DNS details for this domain.” | Detailed DNS troubleshooting and scripting |
whois |
“Who owns this domain?” | Finding domain registration and ownership info |
traceroute |
“What network path do my packets take to reach you?” | Diagnosing latency and routing problems |
nslookup: The Quick & Simple DNS Checkernslookup (Name Server Lookup) is the classic tool for quick, interactive DNS queries. It’s available by default on both Windows and Unix-like systems.
When to Use nslookup:
dig isn’t installed by default.# Find the IP address for google.com
nslookup google.com
# --- Output ---
# Server: 192.168.1.1
# Address: 192.168.1.1#53
#
# Non-authoritative answer:
# Name: google.com
# Address: 142.250.178.78
dig: The Detailed DNS Detective 🕵️dig (Domain Information Groper) is the preferred tool for network administrators and anyone needing detailed DNS information. It provides verbose, easy-to-parse output and offers much more control over your queries. It’s the standard on most Linux/macOS systems.
When to Use dig:
MX (mail exchange), TXT (text), CNAME (canonical name), etc.# Get detailed info for google.com's MX (mail) records
dig google.com MX
# --- Partial Output ---
# ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5968
# ;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 1
#
# ;; QUESTION SECTION:
# ;google.com. IN MX
#
# ;; ANSWER SECTION:
# google.com. 600 IN MX 10 smtp.google.com.
# google.com. 600 IN MX 20 alt1.smtp.google.com.
# google.com. 600 IN MX 30 alt2.smtp.google.com.
# google.com. 600 IN MX 40 alt3.smtp.google.com.
# google.com. 600 IN MX 50 alt4.smtp.google.com.
#
# ;; Query time: 15 msec
# ;; SERVER: 192.168.1.1#53(192.168.1.1)
whois: The Domain Ownership Investigatorwhois queries a public database to retrieve registration information about a domain name or IP address. It tells you who owns the domain, not how to connect to it.
When to Use whois:
# Find registration info for google.com
whois google.com
# --- Partial Output ---
# Domain Name: GOOGLE.COM
# Registry Domain ID: 2138514_DOMAIN_COM-VRSN
# Registrar WHOIS Server: whois.markmonitor.com
# Registrar URL: http://www.markmonitor.com
# Updated Date: 2019-09-09T15:39:04Z
# Creation Date: 1997-09-15T04:00:00Z
# Registry Expiry Date: 2028-09-14T04:00:00Z
# Registrar: MarkMonitor Inc.
# Registrant Organization: Google LLC
# Registrant State/Province: CA
# Registrant Country: US
hostThe host command is a simple, user-friendly utility for performing DNS lookups. It’s a great middle-ground between the basic nslookup and the verbose dig.
When to use host:
dig.host google.com
# --- Output ---
# google.com has address 142.250.180.14
# google.com mail is handled by 10 smtp.google.com.
pingping is your first stop for checking basic connectivity. It sends a small packet to a host and waits for a reply, measuring the round-trip time.
When to use ping:
ping google.com
# --- Output ---
# PING google.com (142.250.178.78): 56 data bytes
# 64 bytes from 142.250.178.78: icmp_seq=0 ttl=116 time=14.505 ms
# 64 bytes from 142.250.178.78: icmp_seq=1 ttl=116 time=14.234 ms
traceroutetraceroute maps the network path (the “hops”) your packets take to reach a destination host.
When to use traceroute:
traceroute google.com
# --- Partial Output ---
# traceroute to google.com (142.250.178.78), 64 hops max, 52 byte packets
# 1 my-router (192.168.1.1) 2.458 ms 1.321 ms 1.233 ms
# 2 my-isp-gateway (10.0.0.1) 8.125 ms 7.989 ms 8.341 ms
# 3 ...
# 10 some-google-router (108.170.233.107) 15.111 ms 14.887 ms 14.992 ms
# 11 lhr25s33-in-f14.1e100.net (142.250.178.78) 14.654 ms 14.233 ms 14.321 ms