DNS TTL Lookup – Check Domain TTL (Time To Live) – Dig Command

All DNS records have a TTL (time to live) property that specifies the maximum amount of time the record may be cached.

In Linux you can make the DNS TTL lookup using the dig command.

You can both check the current domain remaining TTL as well as find out what TTL value is set on the name server where the domain is hosted on.

Cool Tip: Get a list of all sub-domains of a domain name. Read more →

Check Domain TTL

Check the remaining TTL value of a DNS record:

$ dig +noall +answer shellhacks.com
shellhacks.com.		828	IN	A	185.68.16.139

The remaining TTL value is 828 seconds.

Get the TTL value configured on NS:

$ DOMAIN=shellhacks.com; dig +noall +answer $DOMAIN @$(dig NS $DOMAIN +short|head -n1)
shellhacks.com.		900	IN	A	185.68.16.139

The configured TTL value is 900 seconds.