nslookup
a quick DNS lookupnslookup asks a DNS server for a name and prints the answer. It shows less than dig, but it works the same on Linux, macOS and Windows, which makes it the lookup command you can rely on finding.
The first test when a site will not load: does the name resolve at all?
At the terminal
Read the session first, then the notes: each numbered line in the output is answered by the note with the same number.
What the numbered lines are telling you
The resolver that answered. 127.0.0.53 is systemd-resolved, the local stub on many systems; #53 is the port.
The answer came from a cache rather than from the server responsible for the domain. That is normal.
The IPv4 address the name resolves to.
-type=MX asks which hosts receive mail for the domain, and the address at the end is the DNS server to ask instead of the default.
Switches
A switch changes how the command behaves. These are the ones used day to day; man nslookup lists the rest. Single-letter switches can usually be joined, so -l -a may be written -la.
-type=TYPE- Ask for a record type: A, AAAA, MX, NS, TXT.
SERVER- A DNS server given after the name is asked instead of the default.
-port=NUM- Query a DNS server on another port.
-debug- Print the full response.
-timeout=SECS- How long to wait for a reply.
Variations worth knowing
The same tool, pointed at a narrower question. These four cover most of what it is reached for day to day.
nslookup 192.0.2.80A reverse lookup: the name for an address.
nslookup -type=NS example.comLists the name servers responsible for a domain.
nslookup -type=TXT example.comShows TXT records, where SPF and verification strings live.
dig +short example.comThe same lookup with dig, printing only the address.
In cybersecurity
What a name resolves to decides where your traffic goes.
If your resolver and a public one give different addresses for the same name, either the site uses geo-routing or something is rewriting DNS.
MX, NS and TXT records disclose mail providers, hosting and third-party services. It is the first, entirely passive, step of reconnaissance.
Lookups are visible to everyone on the path and can be forged. DNS over TLS or HTTPS protects them in transit.