• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

Dig Command (Domain Information Groper) to Query DNS

{{postValue.id}}

Various Linux Dig Commands (Domain Information Groper) to Query DNS

Dig command stands for (Domain Information Groper) is a network administration command-line tool for querying Domain Name System (DNS) name servers. It is useful for verifying and troubleshooting DNS problems. In this article we will, learn some useful Dig commands.

Using dig command without any options

The below command will show DNS query status in Verbosely.

[root@linuxhelp ~]# dig linuxhelp.com
  < < > >  DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6 < < > >  linuxhelp.com
   global options: +cmd
   Got answer:
   -> > HEADER< 

To Record using +short options

To cut down the output is to use the +short option.

[root@linuxhelp ~]# dig linuxhelp.com +short 
192.155.206.82

To query MX Record for Domain

Run the following command to query Main Exchange Mx Records.

[root@linuxhelp ~]# dig linuxhelp.com MX
  < < > >  DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6 < < > >  linuxhelp.com MX
   global options: +cmd
   Got answer:
   -> > HEADER< 

To Query SOA Record for Domain

Run the following command to query SOA (Start of Authority) Records.

[root@linuxhelp ~]# dig linuxhelp.com SOA

  < < > >  DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6 < < > >  linuxhelp.com SOA
   global options: +cmd
   Got answer:
   -> > HEADER< 

To Query TTL Record for Domain

Run the following command to query Time To Live (TTL) Records.

[root@linuxhelp ~]# dig linuxhelp.com TTL

  < < > >  DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6 < < > >  linuxhelp.com TTL
   global options: +cmd
   Got answer:
   -> > HEADER< > HEADER< 

To Query only answer section

The below command to query answer section alone.

[root@linuxhelp ~]# dig linuxhelp.com +nocomments +noquestion +noauthority +noadditional +nostats

  < < > >  DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6 < < > >  linuxhelp.com +nocomments +noquestion +noauthority +noadditional +nostats
   global options: +cmd
linuxhelp.com.        14399    IN    A    192.155.206.82

To Query ALL DNS Records Types

The below command will perform query the ALL DNS Records.

[root@linuxhelp ~]# dig linuxhelp.com ANY +noall +answer

  < < > >  DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6 < < > >  linuxhelp.com ANY +noall +answer
   global options: +cmd
linuxhelp.com.        21599    IN    SOA    ns1.yookar.com. peter.netaxis.in. 2016030803 3600 7200 1209600 86400
linuxhelp.com.        21599    IN    NS    ns1.yookar.com.
linuxhelp.com.        21599    IN    NS    ns2.yookar.com.
linuxhelp.com.        21599    IN    NS    ns3.yookar.com.
linuxhelp.com.        21599    IN    NS    ns4.yookar.com.
linuxhelp.com.        14399    IN    A    192.155.206.82
linuxhelp.com.        14399    IN    MX    0 linuxhelp.com.

To Query DNS Reverse Look-up

The following command query the DNS Reverse Look-up

[root@linuxhelp ~]# dig -x 192.155.206.82 +short
52.ce.9bc0.ip4.static.sl-reverse.com.

To Query Multiple DNS Records

The following command to query multiple website’ s DNS specific query viz. MX, NS etc. records.

[root@linuxhelp ~]# dig linuxhelp.com mx +noall +answer google.com ns +noall +answer

  < < > >  DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6 < < > >  linuxhelp.com mx +noall +answer google.com ns +noall +answer
   global options: +cmd
linuxhelp.com.        14366    IN    MX    0 linuxhelp.com.
google.com.        21599    IN    NS    ns3.google.com.
google.com.        21599    IN    NS    ns2.google.com.
google.com.        21599    IN    NS    ns1.google.com.
google.com.        21599    IN    NS    ns4.google.com.

Using &ndash f with Dig command

It is the another method to query the multiple DNS records.
First thing you should create one text file and enter your multiple domain into that text file and then use with dig command by following method.

[root@linuxhelp ~]# dig -f dig.txt

  < < > >  DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6 < < > >  facebook.com
   global options: +cmd
   Got answer:
   -> > HEADER< >  DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6 < < > >  google.com
   Got answer:
   -> > HEADER< >  DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6 < < > >  twitter.com
   Got answer:
   -> > HEADER< 
[root@linuxhelp ~]# dig -f dig.txt +noall +answer
facebook.com.        35    IN    A    173.252.120.68
google.com.        299    IN    A    216.58.197.78 l
twitter.com.        16    IN    A    199.59.148.82
twitter.com.        16    IN    A    199.59.150.7
twitter.com.        16    IN    A    199.59.149.198
twitter.com.        16    IN    A    199.59.149.230

Command to the check the version of Dig tool

[root@linuxhelp ~]# dig -v
DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6

Tags:
connor
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

How to Querying MX Record for Domain using the "dig" command?

A

You can use the following syntax to Querying MX Record for Domain using the "dig" command. For Syntax: "dig www.linuxhelp1.com MX".

Q

How to get information about SOA Record for Domain using the "dig" command?

A

You can use the following command to get information about SOA Record for Domain using the "dig" command. For Syntax: "dig www.linuxhelp.com SOA"

Q

How to displays only the ANSWER SECTION for any domain using the "dig" command?

A

Using the following command to displays only the ANSWER SECTION for any domain using the "dig" command. For Ex: "dig www.linuxhelp.com +nocomments +noquestion +noauthority +noadditional +nostats"

Q

How to create a .dogrc file for any domain using the "dig" command?

A

You will use the following syntax to create a ".dogrc" file for any domain using the "dig" command. For Ex: "dig www.linuxhelp.com".

Q

How to get information about DNS Reverse Look-up for any domain using the "dig" command?

A

Use the following option "-x" with "dig" command to get information about DNS Reverse Look-up for any domain using the "dig" command. For Ex: "dig -x 72.30.38.140 +short".

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Luke ?
workbench for debian

I am using workbench in CentOS whereas now I need to use Debian Operating system so could you please help to install and use in Debian?

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.