What is Nslookup Command & How to Use It

What is Nslookup? How to Use This Command Line Tool

Nslookup is a helpful command prompt that allows you to enter the name of a host and look up the corresponding IP address and domain name system (DNS) record. Users can also use nslookup commands to perform a reverse DNS lookup.

So what is nslookup and how can you use it to manage your website’s servers?

In this article, we’ll look at how nslookup works and how to use it on different operating systems

 

Selecting the right domain hosting provider is crucial for securing a stable and fast online presence. Explore our expertly compiled list of the best domain hosting providers to find the perfect match for your needs.

Top Domain Hosting Providers We Recommend

ProviderUser RatingBest ForExpert & User Reviews 
 5.0VersatilityHostArmada ReviewVisit HostArmada
 4.9CustomizationUltahost ReviewVisit Ultahost
4.6SpeedHostinger ReviewVisit Hostinger
Takeaways
  • Nslookup is a popular command line tool that is used to find domain information and troubleshoot server issues
  • It is available for both Linux and Windows and works similarly on other platforms.
  • Windows offers both interactive and noninteractive mode
  • You can customize your nslookup commands with prompt options. This will provide more specific information about DNS records, IP addresses, and more

What Is Nslookup in Simple Words?

Nslookup is a server command line tool that is available on Windows, Linux, and MacOS. This command prompt provides users with important information about their DNS servers and IP addresses.

To use nslookup, users enter a host name and receive the associated DNS records and the domain’s IP address. A reverse lookup request requires you to enter the IP address and provides the DNS record and host name.

What Is Nslookup Used for?

Nslookup is very helpful for retrieving detailed information about specific domains and their servers. To fully understand the benefits of nslookup, we’ll explore its most common use cases.

Resolving DNS Server Issues

Nslookup is a helpful way to identify and resolve issues with your host server and DNS server.

For example, if your website is down and you suspect a problem with your directory, you can run an nslookup to figure out how to fix DNS server not responding. If the server isn’t online, you’ll receive an error message and can start troubleshooting.

Searching for Optimal Mail Servers

Another popular use case for the nslookup tool is finding the best email server for your site.

By using the “settype=mx” command, you’ll prompt nslookup to search for mail exchange records for your domain name.

These MX records will provide specific server names and IP addresses to reference when setting up your mail servers.

Finding IP Addresses of Domain

Nslookup is often the fastest way to find an IP address for a desired domain. You might need to look up specific IP addresses to troubleshoot network issues. You can also use nslookup to find a specific domain you want to block or unblock.

Nslookup Command in Linux

Nslookup commands are easy to use on the Linux operating system. On Linux, you’ll need to run all commands through the Terminal program.

How to Use Nslookup in Linux

To use nslookup on Linux, you’ll need to open Terminal by pressing Ctrl+Alt+T. Once you’ve opened Terminal, you can enter nslookup prompts directly into the command line interface.

Syntax of the Nslookup Command in Linux System

The syntax of nslookup for Linux is:

nslookup [option] [hostname] [server]

Nslookup Command in Linux

  • [hostname]: This is the domain name you want to query (like example.com).
  • [server]: This is an optional argument where you can specify the DNS server you want to query. If you don’t specify this, nslookup will use the default DNS server configured on your system.

If you’re not using an [option], you can simply type:

nslookup [hostname]

Final: What is Nslookup?

This command queries the default DNS server for information about example.com.

For a reverse DNS lookup, you’ll use the following syntax:

nslookup [IP address]

Final: What is Nslookup?

This attempts to find the hostname associated with the IP address 192.0.2.1.

Nslookup Command Prompt Options in Linux

There are a variety of command prompt options for nslookup on Linux. Many of these options allow you to look up specific record types. These include:

  • -type=mx: Used to look up mail exchange records.
  • -type=hinfo: Provides hardware information about the host server, including the operating system.
  • -type=ns: Provides DNS name server records for your domain query.

Other popular command prompt options in Linux include:

  • -domain=[domain-name]: Used to change the DNS name for a site.
  • -debug: Shows debugging information for the domain.
  • -timeout=[seconds]: Specifies the allowed DNS response time.
  • -port=[port-number]: Specifies the port number for queries. Nslookup uses port 53 as default.

Nslookup Command Examples in Linux

Let’s say you’re interested in the domain information for Amazon. You’d start by entering:

nslookup amazon.com

Final: What is Nslookup?

The output will look like this:

Final: What is Nslookup?

Explanation of the output:

  • Server: This is the name of the DNS server that responded to your query.
  • Address (under Server): This is the IP address of the DNS server that responded.
  • Non-authoritative answer: This indicates that the response is coming from a server that is not the authoritative source for the domain name. (Authoritative answers come from the DNS servers that are the definitive source for information about a domain.)
  • Name: The domain name you queried.
  • Address (under Name): The IP addresses associated with “amazon.com.” There can be multiple addresses listed, reflecting the domain’s hosting on multiple servers for load balancing and redundancy.

If you were interested in looking up MX records, you’d enter:

nslookup -type=mx amazon.com

Final: What is Nslookup?

The output will show the DNS server providing the response and a list of the MX records associated with “amazon.com.” These MX records specify the mail servers responsible for handling email for the domain.

Final: What is Nslookup?

Explanation of the output:

  • Server: The name of the DNS server that responded to your query.
  • Address: The IP address of the DNS server that responded.
  • Non-authoritative answer: This indicates that the response is from a server that is not the authoritative source for the domain name.
  • Mail exchanger records: These lines list the MX records associated with “amazon.com.” Each record typically consists of a priority number (like 10, 20, etc.) and the mail server’s domain name. A lower priority number indicates a higher preference.

If you were interested in debugging information, you’d enter:

nslookup -debug amazon.com

Final: What is Nslookup?

Running nslookup with the -debug option, as in nslookup -debug amazon.com, provides detailed information about the DNS lookup process and the response.

This includes the query sent, the response received, additional details provided by the DNS server, and more diagnostic information. It’s a useful option for troubleshooting or for understanding more about the DNS resolution process.

The output will look like this:

Final: What is Nslookup?

Explanation of the output:

  • Server/Address: This is the DNS server that responded to your query.
  • QUESTIONS: This section shows the question section of the DNS query made by nslookup. Here, it’s asking for records of type ‘A’ (Address) for “amazon.com.”
  • ANSWERS: This section contains the answers received from the DNS server. It lists the A records for “amazon.com” (i.e., the IP addresses associated with the domain), along with their TTL (Time to Live) values.
  • AUTHORITY RECORDS: If provided, this section lists the authoritative DNS servers for the domain.
  • ADDITIONAL RECORDS: Sometimes, additional information is included, such as other related DNS records or extra data provided by the DNS server.
  • Non-authoritative answer: Similar to the regular nslookup output, it lists the domain name and its associated IP addresses.

Nslookup Command in Windows

If you already know how to use nslookup for Linux, you’ll find the process to be very similar in Windows. However, there are some subtle differences in the syntax of the commands.

How to Use Nslookup in Windows

To run nslookup, you’ll need to open Windows Command Prompt. To do this, search for Command Prompt in the task bar. You can also press R + the Windows key, and then type cmd or cmd.exe into the command box.

Final: What is Nslookup?

There are two modes of nslookup in Windows: interactive mode and non-interactive mode.

Interactive mode has a full command list available for reference, while non-interactive mode does not. If you’re only looking up an individual piece of data, non-interactive mode will be faster. However, nslookup interactive mode provides more guidance for an in-depth data search.

Syntax of the Nslookup Command in Windows System

The syntax for nslookup on Windows and Linux is very similar. The basic syntax for nslookup on Windows is:

nslookup [options] [hostname] [server]

Final: What is Nslookup?

  • [hostname]: This is the domain name you want to query (like example.com).
  • [server]: This is an optional argument where you can specify a DNS server you want to query. If you don’t specify this, nslookup will use the default DNS server configured on your system.

Nslookup Command Prompt Options in Windows

Many of the nslookup command prompts for Linux will also work on Windows. Some popular options include -debug and -type=mx.

On Windows, there are also several parameters you can use to manage servers with nslookup. These include:

  • exit: Exits the nslookup tool.
  • finger: Connects with your computer’s finger server.
  • help: Displays a summary of subcommand options.
  • ls: Provides information about a specified DNS domain.
  • lserver: Switch DNS servers from the default server to another option.
  • root: Switches the default DNS server to the DNS root servers.
  • set: Changes the nslookup configuration settings. This command prompt has many possible subprompts.
  • view: Sort and list information from previous commands.

Nslookup Command Windows Examples

If we were to look up Hostadvice’s domain information on Windows, we’d start with:

nslookup hostadvice.com

Final: What is Nslookup?

The output will display information provided by your default DNS server.

Final: What is Nslookup?

  • Server: The DNS server that responded to your query. “UnKnown” means the DNS server’s name is not available, but it’s usually followed by the IP address of the server.
  • Address (under Server): The IP address of the DNS server that responded to your request.
  • Non-authoritative answer: This indicates that the response is from a server that is not the authoritative source for hostadvice.com. It’s a cached response from your local or ISP’s DNS server.
  • Name: The domain name for which you requested information.
  • Addresses: The IP addresses associated with hostadvice.com. There may be multiple addresses listed, reflecting different servers for redundancy or load balancing.

You can also enter an IP address instead of a domain to perform a reverse lookup.

For example, if you want to perform a reverse DNS lookup for the IP address 8.8.8.8, you would type the following command in the Command Prompt:

Final: What is Nslookup?

You can also add extra command parameters or options. For example, to look up an MX record for Host Advice and find a mail server, we’d use:

nslookup -type=mx hostadvice.com

Final: What is Nslookup?

The output will display the MX records for hostadvice.com, which specify the mail servers responsible for handling email services for the domain.

The actual output can vary depending on the current MX records set for hostadvice.com. A typical output might look something like this:

Final: What is Nslookup?

Breakdown of the Output:

  • Server: The DNS server that responded to your query. “UnKnown” means the DNS server’s name is not available, but it’s followed by the IP address of the server.
  • Address (under Server): The IP address of the DNS server that responded to your request.
  • Non-authoritative answer: This indicates that the response is from a server that is not the authoritative source for hostadvice.com. It’s a cached response from your local or ISP’s DNS server.
  • MX preference: This is the priority of the mail server. Lower numbers have higher priority.
  • Mail exchanger: The domain name of the mail server designated to handle emails for hostadvice.com.

Final Word: Use Nslookup to Find Domain Information

So what is nslookup? This handy command line tool helps IT professionals problem-solve a variety of server issues. It’s also a great way to get more information about domains you’re interested in.

Nslookup is also very easy to use. This command line tool is built into Linux, Windows, and Mac operating systems. Once you learn the prompts and syntax, it’s easy to get started.

Recommended Domain Hosting Providers You Should Know

HostArmada: The Best Domain Hosting
HostArmada offers a wide range of Domain TLDs at affordable prices that come with DNS management and email forwarding. They offer a free domain forever as part of all their hosting plans. HostArmada is an excellent solution for anyone looking for a reliable domain registrar and the convenience of managing websites and domains from a single place.
Visit HostArmada

Ultahost Domain Hosting
UltaHost delivers customized hosting solutions for everyone, from beginners to industry giants, emphasizing superior VPS and managed hosting services for hassle-free website functionality. Ultahost offers a free domain, SSL, and many great features, but what really makes it stand out are its highly transparent pricing plans and all the included freebies.
Visit Ultahost
Hostinger Domain Hosting
Boost your website's performance with Hostinger's ultra-fast hosting solutions at unbeatable price. Offering everything from Shared, Managed WordPress, Managed WooCommerce, Cloud, VPS to Game Server Hosting, Hostinger ensures maximum uptime and premium security.
Visit Hostinger

Next Steps: What Now?

Learn More About DNS

Frequently Asked Questions

Why would a hacker use nslookup?

Hackers use nslookup to gather information about their target domains before launching an attack. Domain name server information is essential to launching a successful attack.

What Is the Difference between Ping and Nslookup?

Nslookup and Ping are both used to find domain information. Nslookup does this entirely using the DNS, while Ping uses several additional steps to find an IP address.

What are the different Nslookup Command Modes?

Windows has two command modes for nslookup: interactive and non-interactive. Non-interactive mode is best for short queries, while interactive mode is helpful for more detailed searches.

Is Nslookup a DNS?

Nslookup itself is not a DNS. It is a tool that uses the DNS system to find information about specific domains and IP addresses.

What Is Nslookup Full Form?

Nslookup stands for “name server lookup”. These terms are often used interchangeably.

Sonja Vitas
Edited By:
Sonja Vitas
Content Editor

HostAdvice Speaks to ScalaHosting: An Interview with Chris Rusev

HostAdvice had the opportunity to speak with Chris Rusev, the CEO and co-founder of , a web hosting company that offers shared, cloud VPS, and...
8 min read
Eddie Segal
Eddie Segal
Digital Marketing Specialist

Email Deliverability: What Is It, Key Factors & Best Practices

What is Email Deliverability? Think of it like mailing a letter and making sure it lands right in the recipient's hands, not lost or thrown...
17 min read
Ela Gal-Kfir
Ela Gal-Kfir
Digital Marketing Specialist

Email Marketing vs. Social Media: Which is More Effective?

What is Email Marketing? Email marketing is a  that involves companies reaching out to potential and existing customers via email ...
10 min read
Ela Gal-Kfir
Ela Gal-Kfir
Digital Marketing Specialist

Email Engagement Metrics, Calculation & Best Practices

Email engagement tells us how interested recipients are in the content of emails they receive. It provides insights into what types of em...
12 min read
Ela Gal-Kfir
Ela Gal-Kfir
Digital Marketing Specialist
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top