From ee0ae18a1395a68d77427dd935d89e5a9b6f699a Mon Sep 17 00:00:00 2001 From: Julia Evans Date: Fri, 20 Feb 2026 10:43:26 -0500 Subject: [PATCH] Add examples to the dig man page The goal here is to help new or infrequent users figure out the most basic ways to use dig. Notes on the choice of examples: * I wrote examples that users can copy and paste exactly as is, without having to come up with an appropriate IP address or domain name to use. The one exception is the `dig -x` example which uses an IP from the example range. * `dig +noall +answer` here is because learning about `+noall +answer` was lifechanging for me when I learned about it, I've heard from others that they find it helpful too, and it's pretty hard to infer from the man page as is that it might be useful * I thought about adding `+trace` but left it out because 5 examples was already starting to feel like a lot. (cherry picked from commit 8972ed94242e8de67d7b35c2fa0015dee85a4e5d) --- bin/dig/dig.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/bin/dig/dig.rst b/bin/dig/dig.rst index a38f4eab6e..0759eca546 100644 --- a/bin/dig/dig.rst +++ b/bin/dig/dig.rst @@ -812,6 +812,29 @@ Files ``${HOME}/.digrc`` +Examples +~~~~~~~~ + +Only display the IP address(es) for example.com:: + + dig +short example.com + +Query the nameserver f.gtld-servers.net for example.com:: + + dig @f.gtld-servers.net example.com + +Look up the TXT record for example.com:: + + dig txt example.com + +Look up the hostname for an IP with reverse DNS:: + + dig -x 192.0.2.1 + +Display a much shorter output with just the name, record type, TTL, and value for each answer:: + + dig +noall +answer example.com + See Also ~~~~~~~~