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 +split=0 keeps long keys on one unbroken line

Dig
~/tips/tip-dig-split-zero-keys

dig DNSKEY example.com +noall +answer +split=0

Stop dig from breaking base64 keys and hashes into chunks with spaces, so you can copy them.

dig breaks long base64 and hex fields, like DNSKEY material and DS digests, into chunks with spaces in between. That reads fine, but the copied value is broken.

dig DNSKEY example.com +noall +answer
dig DNSKEY example.com +noall +answer +split=0

In the first output each key has a space after every 56 characters. The second prints the same key as one unbroken string. In +multiline mode the chunks are 44 characters, and +split=0 works there too.

I find it helpful when you paste a DS digest into a registrar form, or compare a key with another tool’s output. A stray space makes a form refuse the value, or worse, makes a comparison fail while the key is actually the same.

You can also pick another width, like +split=64. The manual says dig rounds the width up to a multiple of 4, and dig prints a warning when it adjusts one. This only changes how dig prints the data; the record in DNS is the same either way.

TXT records follow other rules. A long SPF or DKIM value is often stored as several quoted strings, and dig shows each one in quotes. Those quotes and breaks are real parts of the record, not display chunks, so +split does not join them. Remove the " " between the parts yourself.

Further reading: dig manual (BIND 9)

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