nslookup Command Reference: Usage & CI Examples
nslookup queries DNS name servers for records.
nslookup is a widely available DNS lookup tool. It is less script-friendly than dig but is often present where dig is not, which makes it a useful fallback in minimal images.
Common flags and usage
- nslookup <name>: resolve a hostname
- nslookup <name> <server>: query a specific resolver
- -type=MX / -type=TXT: query a record type
- nslookup <ip>: reverse lookup
- Output includes the answering server and address
Example
shell
nslookup api.example.com
nslookup -type=TXT example.com 8.8.8.8In CI
Use nslookup as a quick resolution check when dig is unavailable. Its output is harder to parse than dig +short, so prefer dig for scripted assertions and keep nslookup for interactive debugging.
Key takeaways
- nslookup resolves names and queries record types.
- It is a fallback when dig is not installed.
- dig +short is easier to parse for scripted checks.
Related guides
dig Command Reference: Flags, Usage & CI ExamplesReference for dig: +short, record types, @server, +trace, and a CI example that resolves a hostname to verify…
getent Command Reference: Databases, Usage & CI ExamplesReference for getent: hosts, passwd, group, the NSS-aware lookup advantage, and a CI example that resolves a…
ping Command Reference: Flags, Usage & CI ExamplesReference for ping: -c, -W, -i, the ICMP-blocked caveat, and a CI example that checks basic host reachability…