About
dig sends a DNS query to a name server and prints the full answer, authority and additional sections included. Use it to check a specific record type or trace how a name is delegated. It is part of the BIND suite.
Install it
pkg install dnsutils
Run this inside Termux. If the package is already present, pkg will say so and
do nothing.
Commands worth knowing
6 of the invocations you will actually reach for. Tap the copy button to put one on your clipboard.
dig @1.1.1.1 example.com A Ask a specific public resolver for the address records of a name. Shows what the internet returns, not a local cache. dig +short example.com Print only the answer values, no headers. Convenient inside a script. dig example.com MX Look up the mail exchangers for a domain. That is where its email lands. dig -x 93.184.216.34 Run a reverse lookup on an address. Finds the name attached to it. dig +trace example.com Walk the delegation chain from the root down. Pinpoints the broken record. dig example.com ANY Ask for every record type the server will return, in one query. Worked example
Run dig @1.1.1.1 example.com A and this is what you should see.
$ dig @1.1.1.1 example.com A
;; ANSWER SECTION:
example.com. 3600 IN A 93.184.216.34
example.com. 3600 IN A 93.184.216.35
;; Query time: 12 msec
;; SERVER: 1.1.1.1#53(1.1.1.1) Developed by
Internet Systems Consortium .