☼
⌃
☰

dig

Table of Contents

Dig

Description

dig is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried. Most DNS administrators use dig to troubleshoot DNS problems because of its flexibility, ease of use and clarity of output.

The basic syntax is:

dig [server] [name] [type]

  • [server]: The DNS server to query. If omitted, it uses the system's default.
  • [name]: The domain name to look up.
  • [type]: The type of DNS record to retrieve (e.g., A, MX, NS). Defaults to A.

Examples

Basic NS Lookup

Find the IP address (A record) for a domain.

SH
dig example.com

Short Answer Only

Display only the IP address.

SH
dig example.com +short

Query Specific Record Types

  • MX (Mail Exchange) Records:

    SH
    dig example.com MX
    
  • NS (Name Server) Records:

    SH
    dig example.com NS
    

Query a Specific NS Server

Query Google's public DNS server.

SH
dig @8.8.8.8 example.com

Reverse NS Lookup

Find the domain name for an IP address.

SH
dig -x 93.184.216.34

Trace NS Path

Trace the full delegation path from the root servers.

SH
dig example.com +trace