Use the Linux dog Command to Look Up DNS Records

Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Create a Linode account to try this guide with a $100 credit.
This credit will be applied to any valid services used during your first 60 days.

dog is a command-line DNS client used for looking up DNS records for domain names. It’s an alternative to the popular dig command. The dog command gives you a simpler interface, more readable results, and additional features like DNS over TLS.

In this guide, learn more about dog and how to install and start using it on your Linux system.

Before You Begin

  1. If you have not already done so, create a Linode account and Compute Instance. See our Getting Started with Linode and Creating a Compute Instance guides.

  2. Follow our Setting Up and Securing a Compute Instance guide to update your system. You may also wish to set the timezone, configure your hostname, create a limited user account, and harden SSH access.

This guide is written for a non-root user. Commands that require elevated privileges are prefixed with sudo. If you’re not familiar with the sudo command, see the Users and Groups guide.

What is dog?

dog is an open-source DNS client for the command line, much like the popular dig tool. With dog, you get significant improvements to the interface, along with more readable, color-coded results, and the ability to render those results in JSON. dog also adds support for DNS over TLS (DoT) and DNS over HTTPS (DoH) protocols, giving you more options for securing your DNS lookups.

You can learn more about the dig command and its features in our guide Use dig to Perform Manual DNS Queries .

How to Install dog

  1. Install gcc, tar, and the developer package for libssl or openssl. Choose the command for your particular Linux distribution.

    • On Debian and Ubuntu, you can do so with:

        sudo apt install build-essential tar libssl-dev pkg-config
    • On AlmaLinux, CentOS, and Fedora, you can use:

        sudo dnf install gcc tar openssl-devel
    You may need to update your system’s version of the GNU C library (glibc).
  2. Install Rust . You need Rust to compile the dog source code:

     curl --proto =https --tlsv1.2 -sSf | sh

    When prompted, select 1 for the default installation path.

  3. Either restart your shell session (exiting and logging back in) or run the following command:

     source $HOME/.cargo/env
  4. Navigate to the releases page for dog, identify the latest release, and copy the URL for the .tar.gz file.

    To access the .tar.gz file, navigate to the Tags section of the dog releases page.
  5. Download that file, replacing the URL below with the one you copied:

     curl -LO
  6. Extract the contents of the .tar.gz file, and change into the extracted directory. Replace the filename below with the one for the file you downloaded. Likewise with the directory name, matching the extracted one:

     tar -xvzf v0.1.0.tar.gz
     cd dog-0.1.0
  7. Run the following command to have Cargo compile the binary for dog:

     cargo build --release
  8. Copy the resulting binary into your current user’s PATH:

     sudo cp target/release/dog /usr/local/bin
  9. Verify your installation by checking the installed version of dog:

     dog --version
    dog ● command-line DNS client

How to Use dog

dog gives you much of the same functionality of dig, but pared down to the essential DNS records. This makes dog’s results easier to read and more manageable.

In the section below, you can see how to get started with basic dog queries and learn more about its advanced options. If you want to learn more about DNS and its role in managing your servers, refer to the end of this guide for more resources.

Basic Queries

At its simplest, you can start looking up DNS records with dog just by giving it a hostname:

A 51s

The output includes the record type (A), the domain name, the time until the record is refreshed (51 seconds), and the record’s main contents — a host IP address, in this case. The main contents for a record vary depending on the record type, which you can see with the next example.

dog provides color codes to portions of the records it displays. This helps you navigate the information when your response includes several records, like in the image for the next example command below.

dog looks up A type records by default, which contain IPv4 addresses. But you can easily add more record types to your dog lookup, like this:

A      40s
SOA   58m20s A "" "" 1633608682 12h00m00s 2h00m00s 14d0h00m00s 1h00m00s
SOA   58m20s A "" "" 1633608682 12h00m00s 2h00m00s 14d0h00m00s 1h00m00s
 MX   42m35s   1 ""
 MX   42m35s   10 ""
 MX   42m35s   10 ""
 MX   42m35s   5 ""
 MX   42m35s   5 ""
 NS 1h00m00s   ""
 NS 1h00m00s   ""
 NS 1h00m00s   ""
 NS 1h00m00s   ""
 NS 1h00m00s   ""
 NS 1h00m00s   ""
 NS 1h00m00s   ""
 NS 1h00m00s   ""
TXT   11m02s   "MS=6BF03E6AF5CB689E315FB6199603BABF2C88D805"
TXT   11m02s   "MS=ms44452932"
TXT   11m02s   "MS=ms58704441"
TXT   11m02s   "adobe-idp-site-verification=b92c9e999aef825edc36e0a3d847d2dbad5b2fc0e05c79ddd7a16139b48ecf4b"
TXT   11m02s   "atlassian-domain-verification=jjgw98AKv2aeoYFxiL/VFaoyPkn3undEssTRuMg6C/3Fp/iqhkV4HVV7WjYlVeF8"
TXT   11m02s   "docusign=087098e3-3d46-47b7-9b4e-8a23028154cd"
TXT   11m02s   "stripe-verification=f88ef17321660a01bab1660454192e014defa29ba7b8de9633c69d6b4912217f"
    TXT   11m02s   "v=spf1 ip4: ip4: ip4: ip4: ip4: ip4: ip4: ip4: ip4: ip4: ip4: ~all"

For reference, here are some of the most frequently seen DNS record types, along with brief introductions to each:

  • A: Contain the IPv4 addresses for hosts
  • AAAA: Contain the IPv6 addresses for hosts
  • CNAME: Keep aliases between domains
  • MX: Name the mail server domains behind hosts
  • NS: Give the nameservers responsible for hosts
  • TXT: Hold arbitrary text for informational purposes

You can see the list of record types supported by dog in its official documentation .

As with dig, dog gives you an option to output short records, using the --short flag. With this option, your results only include the main contents of the record — the IP address, for instance, in A records, the mail server in MX records, or the informational text in TXT records:

dog A --short

In addition to providing more readable output, dog also comes with an option to export your results as JSON. Here’s an example that uses a query similar to the one above and saves the results directly as a .json file:

dog A NS TXT --json > dog-github-dns-lookup.json

Advanced Options

Like dig, dog lets you specify a DNS server to use for your query. Domains typically have specifically delegated DNS servers that get used whenever you look up their records. However, you can use a tool like dog to conduct your lookup using an arbitrary DNS server, which can be useful for testing and troubleshooting:

dog @
A 1m00s

Both dig and dog support lookups for the TCP and UDP protocols. dog uses UDP by default, but you can easily use TCP by adding the --tcp flag to your command.

However, in addition to these two protocols, dog adds options for two more: DNS over TLS (DoT) and DNS over HTTPS (DoH). Each of these protocols allows you to make more secure DNS queries.

Here is an example that uses the DoT protocol via a Google DNS server. Using this option can mitigate threats of interference in the request and response:

dog MX --tls
MX 12m40s   1 ""
MX 12m40s   5 ""
MX 12m40s   5 ""
MX 12m40s   10 ""
MX 12m40s   10 ""

Below is an example using the DoH protocol via a Cloudflare DNS server. This protocol can be used for the same reason as the DoT protocol, but has the added feature that it runs on the popular 443 port. That potentially allows it to blend in with other traffic:

dog NS --https @
NS 6m21s   ""
NS 6m21s   ""
NS 6m21s   ""
NS 6m21s   ""
NS 6m21s   ""
NS 6m21s   ""
NS 6m21s   ""
NS 6m21s   ""


To learn more about DNS, including more about record types and the role of DNS in the Internet, take a look at our guide DNS Records: An Introduction . From there, you may also want to look at our guide Troubleshooting DNS Records . It can give you some ideas for how you might use a tool like dog to help keep your DNS setup in order.

This page was originally published on

Your Feedback Is Important

Let us know if this guide made it easy to get the answer you needed.

Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.