{
  "id": "dig",
  "name": "dig",
  "homepage": "https://bind9.readthedocs.io/en/latest/manpages.html#dig-dns-lookup-utility",
  "description": "dig is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers returned.",
  "executables": [
    "dig"
  ],
  "dotfiles": {
    "paths": [
      "~/.digrc"
    ],
    "exclude": [],
    "secret": [],
    "side_effect": false
  },
  "commands": {
    "format": 1,
    "label": "DNS lookup",
    "description": "Query DNS records with dig. Only common query and display options are covered; TSIG keys, batch mode and most +keyword options are left out.",
    "quality": "ai-draft",
    "parser": {
      "end_of_options": "--",
      "interleave": "permute",
      "long_equals": true,
      "short_attached": true,
      "short_bundles": false
    },
    "source": [
      {
        "id": "help",
        "kind": "help",
        "revision": "dig -h (macOS)",
        "evidence": "Usage:  dig [@global-server] [domain] [q-type] [q-class] {q-opt}\n            {global-d-opt} host [@local-server] {local-d-opt}\n            [ host [@local-server] {local-d-opt} [...]]\nWhere:  domain\t  is in the Domain Name System\n        q-class  is one of (in,hs,ch,...) [default: in]\n        q-type   is one of (a,any,mx,ns,soa,hinfo,axfr,txt,...) [default:a]\n                 (Use ixfr=version for type ixfr)\n        q-opt    is one of:\n                 -4                  (use IPv4 query transport only)\n                 -6                  (use IPv6 query transport only)\n                 -b address[#port]   (bind to source address/port)\n                 -c class            (specify query class)\n                 -f filename         (batch mode)\n                 -i                  (use IP6.INT for IPv6 reverse lookups)\n                 -k keyfile          (specify tsig key file)\n                 -m                  (enable memory usage debugging)\n                 -p port             (specify port number)\n                 -q name             (specify query name)\n                 -t type             (specify query type)\n                 -u                  (display times in usec instead of msec)\n                 -x dot-notation     (shortcut for reverse lookups)\n                 -y [hmac:]name:key  (specify named base64 tsig key)\n        d-opt    is of the form +keyword[=value], where keyword is:\n                 +[no]aaonly         (Set AA flag in query (+[no]aaflag))\n                 +[no]additional     (Control display of additional section)\n                 +[no]adflag         (Set AD flag in query (default on))\n                 +[no]all            (Set or clear all display flags)\n                 +[no]answer         (Control display of answer section)\n                 +[no]authority      (Control display of authority section)\n                 +[no]besteffort     (Try to parse even illegal messages)\n                 +bufsize=###        (Set EDNS0 Max UDP packet size)\n                 +[no]cdflag         (Set checking disabled flag in query)\n                 +[no]cl             (Control display of class in records)\n                 +[no]cmd            (Control display of command line)\n                 +[no]comments       (Control display of comment lines)\n                 +[no]crypto         (Control display of cryptographic fields in records)\n                 +[no]defname        (Use search list (+[no]search))\n                 +[no]dnssec         (Request DNSSEC records)\n                 +domain=###         (Set default domainname)\n                 +[no]edns[=###]     (Set EDNS version) [0]\n                 +ednsflags=###      (Set EDNS flag bits)\n                 +[no]ednsnegotiation (Set EDNS version negotiation)\n                 +ednsopt=###[:value] (Send specified EDNS option)\n                 +noednsopt          (Clear list of +ednsopt options)\n                 +[no]expire         (Request time to expire)\n                 +[no]fail           (Don't try next server on SERVFAIL)\n                 +[no]identify       (ID responders in short answers)\n                 +[no]idnout         (convert IDN response)\n                 +[no]ignore         (Don't revert to TCP for TC responses.)\n                 +[no]keepopen       (Keep the TCP socket open between queries)\n                 +[no]multiline      (Print records in an expanded format)\n                 +ndots=###          (Set search NDOTS value)\n                 +[no]nsid           (Request Name Server ID)\n                 +[no]nssearch       (Search all authoritative nameservers)\n                 +[no]onesoa         (AXFR prints only one soa record)\n                 +[no]opcode=###     (Set the opcode of the request)\n                 +[no]qr             (Print question before sending)\n                 +[no]question       (Control display of question section)\n                 +[no]recurse        (Recursive mode)\n                 +retry=###          (Set number of UDP retries) [2]\n                 +[no]rrcomments     (Control display of per-record comments)\n                 +[no]search         (Set whether to use searchlist)\n                 +[no]short          (Display nothing except short\n                                      form of answer)\n                 +[no]showsearch     (Search with intermediate results)\n                 +[no]split=##       (Split hex/base64 fields into chunks)\n                 +[no]stats          (Control display of statistics)\n                 +subnet=addr        (Set edns-client-subnet option)\n                 +[no]tcp            (TCP mode (+[no]vc))\n                 +time=###           (Set query timeout) [5]\n                 +[no]trace          (Trace delegation down from root [+dnssec])\n                 +tries=###          (Set number of UDP attempts) [3]\n                 +[no]ttlid          (Control display of ttls in records)\n                 +[no]vc             (TCP mode (+[no]tcp))\n        global d-opts and servers (before host name) affect all queries.\n        local d-opts and servers (after host name) affect only that lookup.\n        -h                           (print help and exit)\n        -v                           (print version and exit)\n\n"
      },
      {
        "id": "manual",
        "kind": "manual",
        "url": "https://bind9.readthedocs.io/en/latest/manpages.html",
        "revision": "BIND 9 dig(1), 2026-10-27",
        "evidence": "+short, +noshort\n+multiline, +nomultiline\n+tcp, +notcp\n+trace, +notrace\n"
      }
    ],
    "field": [
      {
        "id": "server",
        "label": "Server (@host)",
        "description": "Include the @, e.g. @1.1.1.1. Leave empty for the system resolver.",
        "type": "string",
        "position": 0,
        "sources": [
          "help"
        ]
      },
      {
        "id": "name",
        "label": "Name",
        "type": "string",
        "position": 1,
        "sources": [
          "help"
        ]
      },
      {
        "id": "type",
        "label": "Record type",
        "type": "string",
        "position": 2,
        "suggestions": [
          {
            "value": "A",
            "label": "A"
          },
          {
            "value": "AAAA",
            "label": "AAAA"
          },
          {
            "value": "MX",
            "label": "MX"
          },
          {
            "value": "NS",
            "label": "NS"
          },
          {
            "value": "TXT",
            "label": "TXT"
          },
          {
            "value": "CNAME",
            "label": "CNAME"
          },
          {
            "value": "SOA",
            "label": "SOA"
          },
          {
            "value": "ANY",
            "label": "ANY"
          }
        ],
        "sources": [
          "help"
        ]
      },
      {
        "id": "short",
        "label": "Short answer",
        "type": "boolean",
        "option": [
          "+short"
        ],
        "sources": [
          "manual"
        ]
      },
      {
        "id": "trace",
        "label": "Trace delegation from root",
        "type": "boolean",
        "option": [
          "+trace"
        ],
        "sources": [
          "manual"
        ]
      },
      {
        "id": "tcp",
        "label": "Use TCP",
        "type": "boolean",
        "option": [
          "+tcp"
        ],
        "sources": [
          "manual"
        ]
      },
      {
        "id": "dnssec",
        "label": "Request DNSSEC records",
        "type": "boolean",
        "option": [
          "+dnssec"
        ],
        "sources": [
          "help"
        ]
      },
      {
        "id": "multiline",
        "label": "Multi-line records",
        "type": "boolean",
        "option": [
          "+multiline"
        ],
        "sources": [
          "manual"
        ]
      },
      {
        "id": "ipv4",
        "label": "IPv4 only",
        "type": "boolean",
        "option": [
          "-4"
        ],
        "sources": [
          "help"
        ]
      },
      {
        "id": "ipv6",
        "label": "IPv6 only",
        "type": "boolean",
        "option": [
          "-6"
        ],
        "sources": [
          "help"
        ]
      },
      {
        "id": "port",
        "label": "Port",
        "type": "integer",
        "option": [
          "-p"
        ],
        "sources": [
          "help"
        ]
      },
      {
        "id": "query_class",
        "label": "Query class",
        "type": "string",
        "option": [
          "-c"
        ],
        "suggestions": [
          {
            "value": "IN",
            "label": "IN"
          },
          {
            "value": "CH",
            "label": "CH"
          },
          {
            "value": "HS",
            "label": "HS"
          }
        ],
        "sources": [
          "help"
        ]
      },
      {
        "id": "timeout",
        "label": "Timeout (seconds)",
        "type": "integer",
        "option": [
          "+time"
        ],
        "value_style": "equals",
        "sources": [
          "help"
        ]
      }
    ],
    "task": [
      {
        "id": "lookup",
        "label": "Look up a record",
        "fields": [
          "server",
          "name",
          "type"
        ],
        "required": [
          "name"
        ]
      },
      {
        "id": "short",
        "label": "Short answer",
        "set": {
          "short": [
            true
          ]
        },
        "fields": [
          "server",
          "name",
          "type",
          "short"
        ],
        "required": [
          "name"
        ]
      },
      {
        "id": "trace",
        "label": "Trace resolution",
        "set": {
          "trace": [
            true
          ]
        },
        "fields": [
          "name",
          "type",
          "trace"
        ],
        "required": [
          "name"
        ]
      }
    ],
    "group": [
      {
        "id": "basic",
        "label": "Basic",
        "fields": [
          "server",
          "name",
          "type",
          "short",
          "trace"
        ]
      },
      {
        "id": "advanced",
        "label": "Advanced",
        "fields": [
          "port",
          "query_class",
          "timeout",
          "multiline",
          "dnssec",
          "ipv4",
          "ipv6",
          "tcp"
        ]
      }
    ]
  }
}
