You can use nslookup
to query a doman name server (DNS).
Determine which name server is used by a domain
Query the [domain] name server (NS) record to find out which name servers it uses:
nslookup -type=ns [domain]
E.g: Query the NS record for example.com:
me@pc ~ $ nslookup -type=ns example.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
example.com nameserver = a.iana-servers.net.
example.com nameserver = b.iana-servers.net.
Authoritative answers can be found from:
In this case I am using 8.8.8.8 (Google’s DNS) on my PC and example.com’s DNS are a.iana-servers.net and b.iana-servers.net.
Query all DNS records for a domain
Query all DNS records for a [domain]:
nslookup -type=any [domain]
E.g: Query all DNS records for example.com:
me@pc ~ $ nslookup -type=any example.com
;; Truncated, retrying in TCP mode.
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
example.com
origin = sns.dns.icann.org
mail addr = noc.dns.icann.org
serial = 2015060332
refresh = 7200
retry = 3600
expire = 1209600
minimum = 3600
Name: example.com
Address: 93.184.216.34
example.com rdata_46 = A 8 2 5 20150627193231 20150620122914 6495 example.com. jYy1VK914LmrwQtKERCkBL3ybouoiVQo1+R0/Lmh/y/3HNl9NkWtAgZ7 a25J4dD28WeZ/0icRiw3oQjLA5frej0zguZmrMrpt9nF6ur3Lu1SZ494 uRfcvXNkHsoYap1/5XqBGNZ/nUcBCOmPpWycYU57BIBo0HfF/ahGVvAg woI=
example.com nameserver = b.iana-servers.net.
example.com nameserver = a.iana-servers.net.
example.com rdata_46 = NS 8 2 5 20150627173937 20150620122914 6495 example.com. C17v0PwrQ/YzgiopEy+Kki08pZzgO8zSjVZc6DBGCMGjOcrXxCh2pYC9 agdjqwrLBYD/MvkHfsLnqcpHbVEy8ZhMm3F1KpcUbYC7E7/CcVyVMMoQ e8g7LRhgDY8JH0nLcJsQWRyrEVMoI9nFChnNb+wrlExPS+iVF871MlCt Y8w=
example.com rdata_46 = SOA 8 2 5 20150627212620 20150620122914 6495 example.com. gOF2aKbbGQKOAAOLeYn+7c+llvzmWKBnAi/hjT1HOtz2w6W/1+uvqpBk 5TSJJmfOXd6KrlKaELPOfvtXsxpZmFk4gvI73sXNX3Q3VIL460KH4AJF Bbu2kZ4aBqF0bbpiyX1pSeQ3Suw75eEODoUbU7Hb0/WEs9Y97mYxMMIa B2E=
example.com text = "v=spf1 -all"
... etc ...
Query a particular DNS record
To query the [record] record for [domain]:
nslookup -type=[record] [domain]
E.g: Query MX server of mindspill.net:
me@pc ~/mindspill $ nslookup -type=MX mindspill.net
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
mindspill.net mail exchanger = 20 mx1.123-reg.co.uk.
mindspill.net mail exchanger = 10 mx0.123-reg.co.uk.
Authoritative answers can be found from:
Query a particular name server for records
To query [name server] name server for all DNS records for [domain]:
nslookup -type=any [domain] [name server]
E.g. Query all records on name server a.iana-servers.net for example.com:
me@pc ~ $ nslookup -type=any example.com a.iana-servers.net
;; Truncated, retrying in TCP mode.
Server: a.iana-servers.net
Address: 199.43.132.53#53
example.com
origin = sns.dns.icann.org
mail addr = noc.dns.icann.org
serial = 2015060332
refresh = 7200
retry = 3600
expire = 1209600
minimum = 3600
Name: example.com
Address: 93.184.216.34
example.com rdata_46 = A 8 2 5 20150627193231 20150620122914 6495 example.com. jYy1VK914LmrwQtKERCkBL3ybouoiVQo1+R0/Lmh/y/3HNl9NkWtAgZ7 a25J4dD28WeZ/0icRiw3oQjLA5frej0zguZmrMrpt9nF6ur3Lu1SZ494 uRfcvXNkHsoYap1/5XqBGNZ/nUcBCOmPpWycYU57BIBo0HfF/ahGVvAg woI=
example.com nameserver = a.iana-servers.net.
example.com nameserver = b.iana-servers.net.
example.com rdata_46 = NS 8 2 5 20150627173937 20150620122914 6495 example.com. C17v0PwrQ/YzgiopEy+Kki08pZzgO8zSjVZc6DBGCMGjOcrXxCh2pYC9 agdjqwrLBYD/MvkHfsLnqcpHbVEy8ZhMm3F1KpcUbYC7E7/CcVyVMMoQ e8g7LRhgDY8JH0nLcJsQWRyrEVMoI9nFChnNb+wrlExPS+iVF871MlCt Y8w=
example.com rdata_46 = SOA 8 2 5 20150627212620 20150620122914 6495 example.com. gOF2aKbbGQKOAAOLeYn+7c+llvzmWKBnAi/hjT1HOtz2w6W/1+uvqpBk 5TSJJmfOXd6KrlKaELPOfvtXsxpZmFk4gvI73sXNX3Q3VIL460KH4AJF Bbu2kZ4aBqF0bbpiyX1pSeQ3Suw75eEODoUbU7Hb0/WEs9Y97mYxMMIa B2E=
example.com text = "$Id: example.com 4054 2015-06-02 22:45:32Z mvergara $"
example.com text = "v=spf1 -all"
Reference: Linux and Unix nslookup command