Skip to content
TrySitePrice

Linux and Unix dig Command Examples

Best/Tutorial

The dig command in Linux and Unix is used to query the Domain Name System (DNS) to retrieve information about hostnames, IP addresses, and other DNS-related information. The dig command can be used to perform various types of DNS lookups, such as checking the A (address) record for a hostname, the MX (mail exchange) record for a domain, or the NS (name server) record for a domain.

Here are some examples of how to use the dig command:

  1. Perform a basic DNS lookup:
dig example.com
  1. Display the A record for a hostname:
dig example.com A
  1. Display the MX record for a domain:
dig example.com MX
  1. Display the NS record for a domain:
dig example.com NS
  1. Display the reverse DNS lookup for an IP address:
dig -x IP_ADDRESS
  1. Display the authoritative name servers for a domain:
dig example.com NS +auth
  1. Display the additional information for a DNS lookup:
dig example.com +trace