In this tutorial, you will get some useful examples for nslookup command available on Linux servers. This command is also available on Windows systems as well.

1. Basic DNS Lookup

Use nslookup command followed by the domain name will return the Address records for a domain. For example, to view DNS record for domain, type:

What is Authoritative and Non-authoritative DNS?

2. Reverse DNS Lookup

A Reverse DNS (rDNS) lookup is when you have an IP address and want to find the associated domain name. You will see any output only if a reverse zone is configured corresponding to that IP address. Generally, this is configured by the hosting provider or datacenters. To view the reverse dns lookup for an IP address, type:

3. Query to Specific DNS Server

The default nslookup quires to DNS server configured on your system’s network interface. But you can specify the DNS server to which nslookup queried directly instead of local configured. You need to pass an additional parameters of name server IP address or domain name. For example to query to name server use the following command.

4. Find SOA Record for Domain

SOA is the abbreviation of Start of Authority. This is a useful DNS record for any domain that contains administrative information about the zone. To find the SOA record of any domain, you need to specify -type=soa as command line parameter. For example: Description of the result values:

origin: The authority from which the information originated. mail addr: The email address of the domain administrator (The first dot represents @ symbol in an email address). serial: The revision data for the zone for of domain in the form YYYYMMDDNN. refresh: A refersh interval in seconds where the secondary name server will check the primary name server for an updated revision of the zone. retry: Waiting time for the secondary nameserver before attempting to reconnect to the primary name server after a failed attempt. expire: The time in seconds for the secondary nameserver’s cache to expire. minimum: The time in seconds the secondary nameserver’s cache should not be refreshed if time has not elapsed since the last refresh.

5. Query MX Record

The Mail Exchange record is used for email delivery to the correct email server IP address. You can also find the MX records for any domain to verify the settings. In case of, emails are not delivering to the Mailbox, verify that MX records are pointed to the correct addresses. Remember that MX records are used for receiving emails not for sending.

6. Query TXT Records for Domain

TXT records are useful for multiple types of records like DKIM, SPF, etc. You can find all TXT records configured for any domain using the below command.

7. Find All Records of Domain

Use -query=any to list all avaialble records for a domain in dns server.

8. Using nslookup in Interactive Mode

We can also use nslookup in interactive mode. To go in interactive mode type nslookup on console and press enter. You will get nslookup prompt like > . Here you can run the same query and get the information for the domain from the DNS server. For your understanding, I have added comments in between commands.


In this tutorial, you have got a basic understanding of the Linux nslookup command with examples. This will help you to troubleshoot the DNS-related issues.