Linux command to inspect TXT records of a domain

271,046

Solution 1

Dig will also do it quite nicely: dig -t txt example.com and if you add the +short option you get just the txt record in quote marks with no other cruft.

Solution 2

The host(1) command has a nice, terse output:

$ host -t txt google.com
google.com descriptive text "v=spf1 include:_netblocks.google.com ip4:216.73.93.70/31 ip4:216.73.93.72/31 ~all"
$ wajig findfile $(which host)
bind9-host: /usr/bin/host
$ 

With dig(1) I "have" to add the "+short" option all the time as well.

(I'm on Debian).

Share:
271,046

Related videos on Youtube

John
Author by

John

We consult and build stuff out of Toronto!

Updated on September 17, 2022

Comments

  • John
    John almost 2 years

    Is there a linux shell command that I can use to inspect the TXT records of a domain?

  • Nic Cottrell
    Nic Cottrell almost 12 years
    According to my DNS manager, I have 4 TXT records - an SPF one with host "@" and then 3 for domainkeys. However, dig -t only shows the SPF value. Any ideas?
  • Robert Brisita
    Robert Brisita about 8 years
    @NicCottrell and anyone else wondering about this; it is because of the domain you are querying. To view domain keys using dig it would be: dkim-selector._domainkey.example.com If Google was your email provider: dig -t txt google._domainkey.example.com
  • Rick
    Rick about 4 years
    And dkim-selector is what your email server will write down on the email header, while dmarc is defined to be _dmarc prefix .
  • Patrick Mevzek
    Patrick Mevzek almost 4 years
    You can put options in a ~/.digrc file in order to never add them on command line again.
  • Admin
    Admin about 2 years
    The reason for the mismatch, is dig doesn't show the sub-domains. You have to explicitly request that: dig some._domainkey.foobar.com txt +short