Skip to content

Usage of dig command

Introduction

The dig command is a popular tool for querying DNS (Domain Name System) servers to obtain information related to domain names. It is a powerful command-line tool used to perform various DNS queries. It is available on most Unix-based systems and can be used to troubleshoot and diagnose DNS-related issues. In this article, we will explore some common usage of the dig command.

Usage

install dig

apt install dnsutils
## or
yum install bind-utils

simple query

dig example.com

query with specific type

## query type is one of (a,any,mx,ns,soa,hinfo,axfr,txt,...) [default:a]
dig txt example.com

shorten the result

dig +short example.com

verbose the process

dig +trace example.com

specify DNS server

dig @114.114.114.114 example.com

how-dns-works.png

Conclusion

The dig command is a powerful tool for querying DNS servers and retrieving information related to domain names. It can be used to troubleshoot and diagnose DNS-related issues, as well as to compare the response of different DNS servers. By mastering the common usage of the dig command, you can become a more efficient and effective system administrator.

reference

  • https://aws.amazon.com/route53/what-is-dns/
  • https://www.cloudflare.com/learning/dns/what-is-dns/
  • https://www.verisign.com/en_US/website-presence/online/how-dns-works/index.xhtml
Leave a message