DNS replies contain protocol details that matter during troubleshooting, but those headers and statistics can obscure the record values needed for a quick lookup. The +short option makes dig print the returned data without the normal response envelope.

Short output keeps each record type's presentation format. Address records appear as one address per line, while MX records retain the preference number and mail exchanger name. Multiple answers can arrive in a different order on later lookups.

The compact form does not show the DNS response status. A received reply with no answer records can therefore produce no lines for either a missing record type or a nonexistent name. Retry an empty result without +short to read the DNS status; if no server replies, dig prints a communications error and exits with status 9 instead of presenting an unexplained blank result.

Steps to show short DNS answers with dig:

  1. Print the A record values for a hostname.
    $ dig +short example.com A
    172.66.147.243
    104.20.23.154

    +short removes the owner name, TTL, record class, record type, response status, and query statistics. Each returned address occupies its own line.

  2. Request the MX answer to retain its type-specific fields.
    $ dig +short example.com MX
    0 .

    The number is the MX preference. A single dot is a null mail exchanger, which declares that the domain does not accept email.

  3. Check the short response for a reserved nonexistent name.
    $ dig +short no-such-name.invalid A

    No output follows the command because +short does not display the NXDOMAIN response status.

  4. Repeat the empty query in verbose form to identify its DNS status.
    $ dig no-such-name.invalid A
    ##### snipped #####
    ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 55544
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
    ##### snipped #####

    NXDOMAIN confirms that the queried name does not exist. dig still exits with status 0 because it received a DNS response; a no-reply failure uses exit status 9.

  5. Confirm that +short still returns a positive A answer for example.com.
    $ dig +short example.com A
    172.66.147.243
    104.20.23.154