Skip to Content

How to Check DNS TTL in Linux

DNS TTL, or time to live, is the element of a DNS record that tells the requester how long the record is valid.

In other words, if the TTL for our DNS record is set to 24 hours, once a browser has resolved that DNS record, it will continue to use that same value for the next 24 hours regardless of whether the DNS record is updated or not.

Understanding DNS TTL Values 

Usually, TTL value is 86400 seconds, which is 24 hours. This is a good starting point for most records. However, we can set higher TTL for MX or CNAME records as they are expected to change very rarely. If our service is critical, it is recommended that we set TTL to 1 hour (3600 seconds).

How to check DNS TTL in Linux

The easiest way to look up TTL settings is to use the dig utility. It is available on Linux, Unix, and Mac OS X. From the shell (command line), type: dig This will return the DNS information (including TTL values) for the domain name.


  • 0 IN A
  • 0 IN A
  • 0 IN A
  • 0 IN A
  • 0 IN A
  • 0 IN A

When to Use a Long DNS TTL

Here are the DNS records that should have longer TTL’s:

  • MX record (points to the mail server)
  • DKIM and SPF (usually configured with MX records)
  • TXT record
  • Records that point to the webserver or CDN, A and CNAME records respectively, will typically have a longer TTL since they are rarely changed. For these, we would want to set a TTL of 12 hours to 1 day.


Keep in mind, we will need to lower the TTL and wait until caches expire (usually around a day) before making any changes.