Linux for Developers Course
Linux for Developers
/
Intermediate

DNS Tools (dig / nslookup)

Definition

Command-line tools used for querying Domain Name System (DNS) servers to resolve hostnames to IP addresses, or vice-versa.

Explain Like I'm New

Asking the internet phonebook a direct question. You ask 'Where does google.com point?', and it tells you the exact IP address and how it found it.

Real World Example

A company changes their website's server. Customers complain they still see the old website. The admin types `dig mycompany.com`. The output proves that the global DNS records have not updated yet.

Common Use Cases

  • •Verifying domain migrations
  • •Troubleshooting DNS caching

Interview Questions

basic

  • Which command is older and generally considered deprecated: `dig` or `nslookup`?

intermediate

  • What does it mean to query a specific DNS server using `dig @8.8.8.8 example.com`?

Flash Cards

Question

Which is older?

Click to reveal answer
Answer

`nslookup` is the older, legacy tool. `dig` is the modern, much more verbose standard.

Question

What does @ do?

Click to reveal answer
Answer

It tells `dig` to ignore your computer's local internet provider settings, and instead ask Google's public DNS server (8.8.8.8) directly what it thinks the IP address is.