~2 min read • Updated Jul 21, 2025
1. What Is nslookup?
nslookup queries DNS servers for domain name resolution and is useful for inspecting basic DNS behavior. Though older and less flexible than dig, it’s still available on many systems and familiar to network admins.
2. Installing nslookup
It’s part of the dnsutils or bind-utils packages:
sudo apt install dnsutils
sudo yum install bind-utils3. Basic Usage
nslookup example.com
Returns the IP address and DNS server information.
4. Useful nslookup Queries
- Query using a specific DNS server:
nslookup example.com 8.8.8.8
nslookup -query=MX example.com
nslookup -type=NS example.com
5. What Is host?
host is a compact DNS lookup tool that gives concise output for common record types. It’s simpler than nslookup and well-suited for scripting and automation.
6. Installing host
Also included in dnsutils:
sudo apt install dnsutils7. Basic Usage of host
host example.com
Displays IPv4 or IPv6 addresses directly.
8. Common host Options
- Query specific record type:
host -t MX example.com
host -t NS example.com
host -t TXT example.com
host example.com 8.8.8.8
host 8.8.8.8
9. Comparison Table
| Feature | nslookup | host |
|---|---|---|
| Output format | Verbose | Concise |
| Supports multiple record types | ✅ | ✅ |
| Script-friendly | ❌ | ✅ |
| Specify DNS server | ✅ | ✅ |
10. Practical Use Cases
- Check if a domain resolves correctly
- Validate email-related DNS records (MX, SPF)
- Debug DNS server response behavior
- Incorporate checks into automation scripts
11. Conclusion
nslookup and host offer simple, fast methods for DNS diagnostics in Linux. While dig provides more detail and flexibility, these two tools are valuable for quick checks, scripting, and basic troubleshooting.
Written & researched by Dr. Shahin Siami