---
title: 'Linux dig command - usage and examples | Zomro'
description: 'The `dig` command is an indispensable tool for working with DNS on the Linux platform. Let''s consider its use.'
image: 'https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/vitaliy.darmoroz%40zomro.org/2023/08/28/image-20230828191358-1_X9KSDwO.png'
---

![opened image]()

  * [Zomro](https://zomro.com/)
  * [FAQ](https://zomro.com/blog/faq/)
  * Linux dig command - usage and examples. 



# Linux dig command - usage and examples.

30-08-2023

In today's technology world, networks play a critical role. Communication and access to resources on the Internet requires knowledge of how domain names work and the DNS resolution process. The `dig` command (Domain Information Groper) is an indispensable tool for working with DNS on the Linux platform. In this article, we will look at what the `dig` command is, how to use it, and give practical examples of its use.

ZOMRO / contact form

Need help from a system administrator? 

Describe the issue and we will get back to you within 15 minutes.

Your name 

Your email 

Phone 

Describe the problem 

LEAVE A REQUEST →  [ ![](/static/site/imagesNew/svg/telegram-btn-icon.svg?v=1793704481) Message us on Telegram ](https://t.me/zomro_sysadmin)

You can find the full list of services and prices on the page [ Server administration and maintenance services. ](/paid-support-services/server-management-services)

## **An overview of the dig command.**

The `dig` command is a command line utility for querying DNS servers. It can retrieve various information about domain names, such as IP addresses, MX records (for email), NS records (name server names), and more. It is a powerful tool for diagnosing network problems, checking DNS settings, and general analysis of domain names.

## **Using the `dig` command**

The syntax for the `dig` command is as follows:
    
    
    dig [key] [domain] [dns-record]

Where:

\- `key` are additional options to customize the request.  
\- `domain` is the name of the domain for which the request will be made.  
\- `dns-record` is the type of DNS record you want to retrieve (A, MX, NS, etc.).

## **Examples of using the `dig` command.**

### **1\. Obtaining an IP address from a domain name:**
    
    
    dig google.com A

This query will return the IP addresses for the google.com domain. Result of command execution:

![Linux dig command - usage and examples. - 1](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/vitaliy.darmoroz%40zomro.org/2023/08/28/image-20230828191358-1_X9KSDwO.png)

### **2\. Getting MX records for the mail domain:**
    
    
      dig example.com MX

Where instead of example.com, specify the domain you need, for example google.com. The query will return information about the mail servers responsible for delivering mail on the specified domain.

![Linux dig command - usage and examples. - 2](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/vitaliy.darmoroz%40zomro.org/2023/08/28/image-20230828191720-2_hdTqoec.png)

You can, for the convenience of reading the data output, use the additional key "+short". This will reduce the output of non-essential information, and make a short output with important data.

### **3\. Getting the names of the name servers for the domain.**
    
    
    dig yahoo.com

![Linux dig command - usage and examples. - 3](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/vitaliy.darmoroz%40zomro.org/2023/08/28/image-20230828192155-3_d2SiEyU.png)

This query will return a list of nameservers responsible for the specified domain, such as yahoo.com.

### **4\. Checking the availability and correctness of domain DNS records on DNS servers.**
    
    
    dig @8.8.8.8 google.com

This query will send a query to the Google DNS server with the IP address 8.8.8.8 and return the IP address information for the google.com domain. For verification, you can use:

This command is useful when changing your domain's DNS records. In particular, after changing the A-record or MX-records in DNS hosting. Allows you to check whether the DNS records you specified have changed on the DNS server. And check how quickly these DNS records appear after updating on Google's DNS servers. Because DNS records are updated from an hour to 24 hours on other DNS servers (third-party companies or resources).

**Results**

The `dig` command is a powerful and interesting tool for manipulating DNS queries and diagnosing network problems. With it, you can get various DNS records, analyze DNS server settings, and check domain availability. Understanding the use of `dig` can greatly facilitate network administration and DNS-related problems.

​We also suggest you other useful articles:

  * [Working with Cache and Buffered Memory in Linux: Overview and Cleaning Guide](https://zomro.com/blog/faq/368-working-with-cache-and-buffered-memory-in-linux-overview-and-cleaning-guideworking-with-cache-and-buffered-memory-in-linux-overview-and-cleaning-guideworking-with-cache-and-buffered-memory-in-linux-ov)
  * [Using the host command in Linux](https://zomro.com/blog/faq/396-using-the-host-command-in-linux)
  * [Cleaning up old logs and temporary files on Linux servers](https://zomro.com/blog/faq/371-cleaning-up-old-logs-and-temporary-files-on-linux-servers)



Similar articles:

[Setting an individual password in Filegator](https://zomro.com/blog/faq/414-ustanovka-individualnogo-parolya-v-filegator) [Installation of PostgreSQL and pgAdmin4 on HestiaCP panel](https://zomro.com/blog/faq/326-ustanovka-postgresql-i-pgadmin4-na-panel-hestiacp) [How to disable Defender (Microsoft Defender) in Windows 2016 and 2019](https://zomro.com/blog/faq/347-how-to-activate-microsoft-defender-in-windows-2016-and-2019) [How to fix black screen in RDP connection](https://zomro.com/blog/faq/502-how-to-fix-black-screen-in-rdp-connection) [How to setup an SFTP-server quickly in Windows](https://zomro.com/blog/faq/394-quick-setup-of-the-sftp-server-on-windows-server)

[ Dedicated servers from €74.24/mon ](/dedicated-servers)

![](/static/site/imagesNew/blogSupport/popup-server.avif?v=1793704481)

ZOMRO / SERVER MANAGEMENT

Need a sysadmin's help? 

Describe the issue and we will get back to you within 15 minutes.

Your name 

Your email 

Phone 

Describe the problem 

LEAVE A REQUEST →  [ ![](/static/site/imagesNew/svg/telegram-btn-icon.svg?v=1793704481) Message us on Telegram ](https://t.me/zomro_sysadmin)

You can find the full list of services and prices on the page [ Server administration and maintenance services. ](/paid-support-services/server-management-services)

Your data has been successfully sent!

Thank you for contacting us. We will get back to you shortly.

Got it! 
