Linux Terminal Command: nslookup

The nslookup command is an essential tool in Network Utilities. In this tutorial, we will explore what nslookup does, look at everyday examples, and cover advanced options to supercharge your command-line workflow.


Concept & Explanation

The nslookup command queries DNS servers to translate domains to IP addresses or vice versa.


Common Options & Syntax

nslookup [options] [arguments]

Here are the most common flags used with nslookup:


1. Interactive Example (Simple)

Here is how most people run the command:

# Example
nslookup google.com

What it does: Performs a DNS lookup for ‘google.com’.


2. Power-User Example (Advanced)

For scripting and advanced diagnostics, use this configuration:

# Advanced
nslookup -type=mx google.com 8.8.8.8

What it does: Queries Google DNS (8.8.8.8) to locate the Mail Exchange (MX) records for ‘google.com’.


⚙️ Warning & Common Pitfalls

[!WARNING] nslookup is a legacy tool. For advanced debugging, use dig instead.


Here are some related posts on cli_tty1 you might want to check out: