How to see Time-To-Live (TTL) for a DNS record

How do I see Time-To-Live (TTL) for a DNS record using Linux, macOS, *BSD, or Unix-like systems command line option? How do I find my DNS TTL?

TTL is an acronym for “Time To Live.” You can set TTL for the DNS record that defines how long a resolver supposed to cache the DNS query before the query expires. TTL typically used to reduce the load on your authoritative name servers and to speed up DNS queries for clients. This page explains how to find Time-To-Live (TTL) for a DNS record using Linux or Unix command-line options.
Tutorial details
Difficulty level Easy
Root privileges No
Requirements dig command on Linux, macOS, and Unix OS
Est. reading time 4 minutes

Find Out Time-To-Live (TTL) for a DNS record

  1. Open the terminal application on your Linux/macOS/Unix desktop
  2. Type dig TYPE DomainNameHere NS1-AUTHNAME-SERVER-HERE and note down TTL from the answer section
  3. To find TTL value directly from the authoritative DNS server, pass the +noauthority +noquestion +noadditional +nostats option to dig command
  4. Pass the +ttlunits option to the dig to display TTL value in a human-readable time format or units such. For instance, 5m TTL means 5 minutes

Let us see all examples in details.

How to see Time-To-Live (TTL) DNS record

The syntax is as follows for the dig command:
dig TYPE domain
dig TYPE domain auth-name-server-here
dig [options] TYPE domain auth-name-server-here

To check the TTL for using local DNS resolver (result might be cached), run:
dig A

So TTL for DNS A record is 176 seconds.

How can I get the TTL for using authoritative DNS server

First, find the NS for given domain:
dig +short NS
Sample outputs:

Now, we can either use ‘’ or ‘’ as follows to avoid caching issues:
dig A

Common DNS record types for TTL with examples

  • A or AAAA Record : IPv4 or IPv6 address. (dig AAAA
  • CNAME Record : Canonical Name or alias. (dig CNAME
  • MX Record : Mail server/mail exchanger. (dig MX
  • TXT Record : Used for various purpose such as describing SPF record. (dig TXT
  • NS Record : Authoritative DNS. (dig NS

How do I find my DNS TTL?

So far, all examples give out a long answer from the dig. However, if you need just the TTL value, you can try the following syntax:
dig +nocmd +noall +answer +ttlid A
dig +nocmd +noall +answer +ttlid AAAA
dig +nocmd +noall +answer +ttlid MX

Sample outputs from the last command:		299	IN	MX	1		299	IN	MX	10		299	IN	MX	10		299	IN	MX	5		299	IN	MX	5

How to get friendly human-readable time units for my TTL

Pass the +ttlunits as follows to display the TTL in friendly human-readable time units of “s”, “m”, “h”, “d”, and “w”, representing seconds, minutes, hours, days and weeks:
dig +nocmd +noall +answer +ttlunits A
dig +nocmd +noall +answer +ttlunits MX
dig +nocmd +noall +answer +ttlunits NS

See Time-To-Live (TTL) is now defined in a nice format such as 1d (one day) or 5h42m51s (five hourse 42 mintues and 51 seconds) for given DNS record.

A note about Windows users to find Time-To-Live (TTL) DNS record

You need to use the nslookup command. First, open a command prompt window by visiting Start > Command Prompt (also called as cmd.exe) and type the following command:
nslookup -debug
Sample outputs:


    QUESTIONS:, type = A, class = IN
	internet address =
	ttl = 300
	internet address =
	ttl = 300
Non-authoritative answer:
    QUESTIONS:, type = AAAA, class = IN
	has AAAA address 2606:4700:10::6814:bb05
	ttl = 299
	has AAAA address 2606:4700:10::6814:ba05
	ttl = 299
Address: 2606:4700:10::6814:bb05
Address: 2606:4700:10::6814:ba05

In this final example, look up for TTL for ‘AAAA’ record for ‘’ using authoritative name server named ‘’
nslookup -debug -type=aaaa
See Shell script too see Time-To-Live (TTL) for a DNS record that produced the following outputs:

Shell script too see Time-To-Live (TTL) for a DNS record


Time to live (TTL) is a value that implies how long should the data be kept before discarding by DNS resolvers. You learned how to use the dig command to find TTL for troubleshooting purposes. See wikipedia page here for more info on Time-To-Live (TTL) for DNS.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 0 comments... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum