Skip to content

Configuration

Daniel Rodriguez edited this page Jul 10, 2026 · 2 revisions

Configuration (~/.diggrc)

digg supports a config file at ~/.diggrc for setting default options, so you don't have to retype the same flags on every invocation.

How it works

On startup, digg reads ~/.diggrc (if it exists), turns its contents into a list of CLI arguments, and prepends them to the arguments you actually typed on the command line. Everything after that is parsed exactly as if you'd typed it all yourself — config-file options first, then your real arguments.

$ cat ~/.diggrc
+short
+timeout=3

$ digg example.com
# equivalent to: digg +short +timeout=3 example.com

Syntax rules

  • One option per line. Each line becomes exactly one command-line argument — it is not split on whitespace. -p 5353 on a single line will not work, because it would be passed as the single literal token "-p 5353" rather than two separate arguments.
    • To set a flag that takes a separate value (like -p), put the flag and its value on two consecutive lines instead:
      -p
      5353
      
    • Flags that embed their value with = (like +timeout=3) work fine on a single line, since they're already one token.
  • Comments: lines starting with # are ignored.
  • Blank lines are ignored.
  • Order matters: lines are applied top-to-bottom, in the same left-to-right order as if you'd typed them on the command line.

Precedence

Config-file arguments are inserted before your real command-line arguments, so explicit CLI flags are parsed after (and can override) config defaults — with one caveat: some options are simple "turn this on" flags with no corresponding "turn this off" flag. If ~/.diggrc sets one of those, there's no way to disable it for a single invocation from the command line; you'd need to temporarily edit the file instead. Options that do have an explicit off-switch are noted below.

Supported options

Any flag documented in digg --help can go in ~/.diggrc. The most useful ones for a personal default:

Query behavior

Option Effect Off-switch
+tcp Force TCP transport +notcp
+notcp Force UDP transport +tcp
+recurse Enable recursion (default) +norecurse
+norecurse Disable recursion +recurse
+timeout=N Query timeout in seconds (default: 5) set a new +timeout=N
+edns Enable EDNS(0) (default) +noedns
+noedns Disable EDNS(0) +edns

Transport / security

Option Effect Off-switch
+dnssec Request DNSSEC records (sets DO bit) none
+dot Use DNS-over-TLS (port 853) none
+doh Use DNS-over-HTTPS (Cloudflare) none
+doh=google Use DNS-over-HTTPS via Google none
+doh=<url> Use DNS-over-HTTPS via a custom resolver URL none

Output

Option Effect Off-switch
+short Terse output (one value per line) none
+json JSON output none
+yaml YAML output none
+authority Show authority section (default) +noauthority
+noauthority Hide authority section +authority
+additional Show additional section (default) +noadditional
+noadditional Hide additional section +additional

Color output

By default, digg emits color only when standard output is a terminal. It also respects the NO_COLOR convention: set NO_COLOR to any non-empty value to disable ANSI colors.

NO_COLOR=1 digg example.com
Option Effect Off-switch
+color Force ANSI color output, including through a compatible pipe such as less -R +nocolor
+nocolor Disable ANSI color output +color

Explicit +color and +nocolor options take precedence over NO_COLOR, so you can set a personal +nocolor default in ~/.diggrc and override it for one invocation:

digg example.com +color | less -R

Server default

A default server can be set the same way you'd pass it on the command line:

@1.1.1.1

Example ~/.diggrc

# Prefer a fast, privacy-respecting default resolver
@1.1.1.1

# Keep responses terse by default
+short

# Don't wait forever on a bad network
+timeout=3

# I rarely care about the additional (glue) section
+noadditional

With this file in place, digg example.com behaves like digg @1.1.1.1 +short +timeout=3 +noadditional example.com, while digg example.com +json still works normally (JSON isn't affected by any of the config defaults above, since none of them conflict).

Clone this wiki locally