Query the useful DNS record set for a domain
Build a paste-ready command, then review its compatibility and effects before running it.
for type in A AAAA MX NS TXT CAA; do echo "--- $type ---"; dig +short <domain> $type; doneComplete required fields to copy the generated command.
Compatibility
Linux + macOSVerified for Linux, macOS using bash, zsh syntax.
Operational knowledgereview due 2027-01-19
Requirementsforfor must be installed and available on PATH.Network accessThe target must be reachable from the current environment.
Version supportfor Current supported releasesVerified for linux, macos using bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signals--- A ---Representative successful output; values vary with the selected target and system state.
Known errorsfor: command not foundfor is missing or is not available on PATH.
Verifyfor type in A AAAA MX NS TXT CAA; do echo "--- $type ---"; dig +short {{domain}} $type; doneThe output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01forShell loopStarts a loop that repeats the following body for each value.
02typeArgumentPasses type to this command.
03inLoop valuesIntroduces the values assigned to the loop variable.
04AArgumentPasses A to this command.
05AAAAArgumentPasses AAAA to this command.
06MXArgumentPasses MX to this command.
07NSArgumentPasses NS to this command.
08TXTArgumentPasses TXT to this command.
09CAAArgumentPasses CAA to this command.
10;Command separatorEnds this shell statement before the next one begins.
11doLoop bodyStarts the commands executed for each loop value.
12echoCommandRuns the echo stage of this one-liner.
13"--- $type ---"ArgumentPasses "--- $type ---" to echo.
14;Command separatorEnds this shell statement before the next one begins.
15digCommandRuns the dig stage of this one-liner.
16+shortOptionRequests concise output without the normal diagnostic sections.
17<domain>ParameterA value supplied in the Fill parameters section.
18$typeVariableExpands a value from the current shell environment or loop.
19;Command separatorEnds this shell statement before the next one begins.
20doneEnd loopCloses the shell loop.
This advanced community-curated one-liner combines several stages. Review every option and placeholder before running it.
Example input
for type in A AAAA MX NS TXT CAA; do echo "--- $type ---"; dig +short example.com $type; done
Example output
--- A ---
93.184.216.34
--- AAAA ---
2606:2800:220:1:248:1893:25c8:1946
--- MX ---
0 .
--- NS ---
a.iana-servers.net.
b.iana-servers.net.
Illustrative output — exact values vary by system and data.
Official sources