How to use nslookup command in Linux
24 July 2020 | Category : Command

nslookup is networking command tool for look DNS records, this very useful command to helping User to search where the domain is hosted. DNS record has a record query like A, AAAA, CNAME, MX, TXT, and others, in Linux, you can look that DNS record with command nslookup. With this command, you can see anything record in some domain.
In this article, we share about command nslookup which will help you to search a DNS Record for some domain. So, here is the command nslookup will help you :
nslookup Command in Linux
-
nslookup find A record of the domain
To find A record in DNS Record of the domain you can use nslookup to look that. The nslookup command to find A record you can follow this :
nslookup -type=a <domain_name>
Example :
nslookup -type=a linux-id.net
Server: 10.10.0.1
Address: 10.10.0.1#53
Non-authoritative answer:
Name: linux-id.net
Address: 172.67.219.47
Name: linux-id.net
Address: 104.18.59.21
Name: linux-id.net
Address: 104.18.58.21
-
nslookup find Name Server of the domain
The other nslookup command is to find name server of domain, to check the name server you can use this command :
nslookup -type=ns <domain_name>
Example :
nslookup -type=ns linux-id.net
Server: 10.10.0.1
Address: 10.10.0.1#53
Non-authoritative answer:
linux-id.net nameserver = dilbert.ns.cloudflare.com.
linux-id.net nameserver = teagan.ns.cloudflare.com.
Authoritative answers can be found from:
-
nslookup find MX record of the domain
To find where is MX records are pointing in the domain, you can use nslookup command too. To do that follow this command :
nslookup -query=mx <domain_name>
Example :
nslookup -query=mx linux-id.net
Server: 10.10.0.1
Address: 10.10.0.1#53
Non-authoritative answer:
linux-id.net mail exchanger = 0 dc-6f3a8f3b0e9c.linux-id.net.
Authoritative answers can be found from:
-
nslookup find TXT record of the domain
Next, to find the TXT record of the domain you can use too the nslookup command. To find that you can run this command :
nslookup -query=txt <domain_name>
Example :
nslookup -query=txt linux-id.net
Server: 10.10.0.1
Address: 10.10.0.1#53
Non-authoritative answer:
linux-id.net text = "v=spf1 +a +mx +ip4:172.67.219.47 ~all"
linux-id.net text = "google-site-verification=fR2DPzAaouZCkvndrJQ"
Authoritative answers can be found from:
-
nslookup with debug mode
When finding a DNS record with nslookup command maybe you want to find with debug mode. To do that you can run nslookup with this option command :
nslookup -debug <domain_name>
Example :
nslookup -debug linux-id.net
Server: 10.10.0.1
Address: 10.10.0.1#53
------------
QUESTIONS:
linux-id.net, type = A, class = IN
ANSWERS:
-> linux-id.net
internet address = 104.18.59.21
ttl = 300
-> linux-id.net
internet address = 104.18.58.21
ttl = 300
-> linux-id.net
internet address = 172.67.219.47
ttl = 300
AUTHORITY RECORDS:
ADDITIONAL RECORDS:
------------
Non-authoritative answer:
Name: linux-id.net
Address: 104.18.59.21
Name: linux-id.net
Address: 104.18.58.21
Name: linux-id.net
Address: 172.67.219.47
Conclusion
Nslookup is a networking tool command is available on Linux. This command very useful to find a DNS record of some domain. When you looking for some information on DNS record you can run this command with some options to showing specific search a DNS record.