brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: dig +noall +answer prints only the answer section

Dig
~/tips/tip-dig-noall-answer-section

dig +noall +answer example.com A

Prints full record lines without the header, question and statistics blocks.

I find the default dig output too noisy when I only want the records. Two flags remove everything except the part I care about.

dig +noall +answer example.com A
dig +noall +answer example.com MX

+noall switches off every section of the output and +answer turns the answer section back on. You keep the full record lines with name, TTL, class, type and data, which +short drops. That makes the output easy to paste into a ticket or to pipe into awk. Put the flags in this order: if +answer comes before +noall, it gets switched off again.

Further reading: dig manual page

Going deeper: Guide: dig for beginners, look up DNS records and read the answer

More Dig tips dig +noall +answer DS example.com dig nope.iana.org @9.9.9.9 | grep -E 'status|SOA' dig +search nas dig @8.8.8.8 www.google.com +subnet=203.0.113.0/24 dig +yaml example.com A All Dig tips (36) All topics

Link