Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

3 Answers 3

up vote 22 down vote accepted

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.

share|improve this answer
    
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? –  Nicholas Tolley Cottrell Sep 21 '12 at 8:17
add comment

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|improve this answer
add comment

What about nslookup?

share|improve this answer
2  
nslookup is deprecated for a long time and should not be used anymore –  bortzmeyer Jun 7 '10 at 9:17
    
Why exactly? It works... –  Massimo Jun 7 '10 at 9:42
2  
It works, sure, but so does a stylus with a clay tablet. nslookup appears to be a very basic port of the nslookup.exe found in Windows (or maybe it comes from BSD? I don't know). This isn't bad, of course, but the Linux nslookup is ... ls, help, are not implemented. The output is hard to parse by scripts. Both dig and host have a much richer feature set. –  grawity Jun 8 '10 at 9:47
    
No, nslookup is NOT depricated. kb.isc.org/article/AA-00496/0/BIND-9.9.0a3-Release-Notes.htm –  Daniele Testa Apr 25 at 16:43
    
Quote from link above: "nslookup is no longer to be treated as deprecated." –  Daniele Testa Apr 25 at 16:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.