What is the difference between `dig`, `nslookup` and `host`?
IntermediateConceptDNS
Answer
dig is the most detailed and scriptable: shows sections, flags, TTLs, query time and supports +trace, +short, @server. nslookup is older and interactive. host gives concise one-line answers.
dig example.com A +noall +answer
host -t mx example.com
nslookup example.com 1.1.1.1
More on DNS
What does DNS do and what happens when you type a URL into a browser?BeginnerWhat are the common DNS record types?BeginnerWhat is the difference between a recursive resolver and an authoritative server?IntermediateExplain the DNS resolution chain step by step with dig.IntermediateWhat is TTL in DNS and how does it affect changes?BeginnerWhat is negative caching in DNS?Intermediate