{
    "mode": "man",
    "parameter": "dig",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/dig/1/json",
    "generated": "2026-06-15T13:57:10Z",
    "synopsis": "dig  [@server]  [-b address] [-c class] [-f filename] [-k filename] [-m] [-p port#] [-q name]\n[-t type] [-v] [-x addr] [-y [hmac:]name:key] [ [-4] | [-6] ] [name] [type]  [class]  [query‐\nopt...]\ndig [-h]\ndig [global-queryopt...] [query...]",
    "sections": {
        "NAME": {
            "content": "dig - DNS lookup utility\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "dig  [@server]  [-b address] [-c class] [-f filename] [-k filename] [-m] [-p port#] [-q name]\n[-t type] [-v] [-x addr] [-y [hmac:]name:key] [ [-4] | [-6] ] [name] [type]  [class]  [query‐\nopt...]\n\ndig [-h]\n\ndig [global-queryopt...] [query...]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "dig  is  a flexible tool for interrogating DNS name servers. It performs DNS lookups and dis‐\nplays the answers that are returned from the name server(s) that were queried. Most  DNS  ad‐\nministrators  use  dig  to troubleshoot DNS problems because of its flexibility, ease of use,\nand clarity of output. Other lookup tools tend to have less functionality than dig.\n\nAlthough dig is normally used with command-line arguments, it also has a batch mode of opera‐\ntion  for  reading lookup requests from a file. A brief summary of its command-line arguments\nand options is printed when the -h option is given. The BIND 9 implementation of  dig  allows\nmultiple lookups to be issued from the command line.\n\nUnless  it  is  told to query a specific name server, dig tries each of the servers listed in\n/etc/resolv.conf. If no usable server addresses are found, dig sends the query to  the  local\nhost.\n\nWhen  no  command-line  arguments or options are given, dig performs an NS query for \".\" (the\nroot).\n\nIt is possible to set per-user defaults for dig via ${HOME}/.digrc. This file is read and any\noptions in it are applied before the command-line arguments. The -r option disables this fea‐\nture, for scripts that need predictable behavior.\n\nThe IN and CH class names overlap with the IN and CH top-level domain names. Either  use  the\n-t  and  -c  options to specify the type and class, use the -q to specify the domain name, or\nuse \"IN.\" and \"CH.\" when looking up these top-level domains.\n",
            "subsections": []
        },
        "SIMPLE USAGE": {
            "content": "A typical invocation of dig looks like:\n\ndig @server name type\n\nwhere:\n\nserver is the name or IP address of the name server to query. This can be an IPv4 address  in\ndotted-decimal  notation or an IPv6 address in colon-delimited notation. When the sup‐\nplied server argument is a hostname, dig resolves that name before querying that  name\nserver.\n\nIf  no  server  argument  is provided, dig consults /etc/resolv.conf; if an address is\nfound there, it queries the name server at that address. If either of the -4 or -6 op‐\ntions are in use, then only addresses for the corresponding transport are tried. If no\nusable addresses are found, dig sends the query to the local host. The reply from  the\nname server that responds is displayed.\n\nname   is the name of the resource record that is to be looked up.\n\ntype   indicates  what  type  of  query  is required - ANY, A, MX, SIG, etc.  type can be any\nvalid query type. If no type argument is supplied, dig performs  a  lookup  for  an  A\nrecord.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-4",
                    "content": "",
                    "flag": "-4"
                },
                {
                    "name": "-6",
                    "content": "",
                    "flag": "-6"
                },
                {
                    "name": "-b address[#port]",
                    "content": "This  option  sets the source IP address of the query. The address must be a valid ad‐\ndress on one of the host's network interfaces, or \"0.0.0.0\" or \"::\". An optional  port\nmay be specified by appending #port.\n",
                    "flag": "-b"
                },
                {
                    "name": "-c class",
                    "content": "This  option  sets  the query class. The default class is IN; other classes are HS for\nHesiod records or CH for Chaosnet records.\n",
                    "flag": "-c"
                },
                {
                    "name": "-f file",
                    "content": "This option sets batch mode, in which dig reads a list of lookup requests  to  process\nfrom  the  given  file.  Each  line in the file should be organized in the same way it\nwould be presented as a query to dig using the command-line interface.\n",
                    "flag": "-f"
                },
                {
                    "name": "-h",
                    "content": "",
                    "flag": "-h"
                },
                {
                    "name": "-k keyfile",
                    "content": "This option tells dig to sign queries using TSIG or SIG(0) using a key read  from  the\ngiven  file. Key files can be generated using tsig-keygen. When using TSIG authentica‐\ntion with dig, the name server that is queried needs to know  the  key  and  algorithm\nthat  is  being  used.  In  BIND, this is done by providing appropriate key and server\nstatements in named.conf for TSIG and by looking up the KEY record in  zone  data  for\nSIG(0).\n",
                    "flag": "-k"
                },
                {
                    "name": "-m",
                    "content": "",
                    "flag": "-m"
                },
                {
                    "name": "-p port",
                    "content": "This  option  sends the query to a non-standard port on the server, instead of the de‐\nfault port 53. This option is used to test a name server that has been  configured  to\nlisten for queries on a non-standard port number.\n",
                    "flag": "-p"
                },
                {
                    "name": "-q name",
                    "content": "This option specifies the domain name to query. This is useful to distinguish the name\nfrom other arguments.\n",
                    "flag": "-q"
                },
                {
                    "name": "-r",
                    "content": "useful for scripts that need predictable behavior.\n",
                    "flag": "-r"
                },
                {
                    "name": "-t type",
                    "content": "This  option indicates the resource record type to query, which can be any valid query\ntype. If it is a resource record type supported in BIND 9, it can be given by the type\nmnemonic  (such  as  NS or AAAA). The default query type is A, unless the -x option is\nsupplied to indicate a reverse lookup. A zone transfer can be requested by  specifying\na  type of AXFR. When an incremental zone transfer (IXFR) is required, set the type to\nixfr=N. The incremental zone transfer contains all changes made to the zone since  the\nserial number in the zone's SOA record was N.\n\nAll  resource  record  types can be expressed as TYPEnn, where nn is the number of the\ntype. If the resource record type is not supported in BIND 9, the result is  displayed\nas described in RFC 3597.\n",
                    "flag": "-t"
                },
                {
                    "name": "-u",
                    "content": "stead of milliseconds.\n",
                    "flag": "-u"
                },
                {
                    "name": "-v",
                    "content": "",
                    "flag": "-v"
                },
                {
                    "name": "-x addr",
                    "content": "This option sets simplified reverse lookups, for mapping addresses to names. The  addr\nis an IPv4 address in dotted-decimal notation, or a colon-delimited IPv6 address. When\nthe -x option is used, there is no need to provide the name,  class,  and  type  argu‐\nments.   dig  automatically  performs a lookup for a name like 94.2.0.192.in-addr.arpa\nand sets the query type and class to PTR  and  IN  respectively.  IPv6  addresses  are\nlooked up using nibble format under the IP6.ARPA domain.\n",
                    "flag": "-x"
                },
                {
                    "name": "-y [hmac:]keyname:secret",
                    "content": "This  option  signs  queries using TSIG with the given authentication key.  keyname is\nthe name of the key, and secret is the base64-encoded shared secret. hmac is the  name\nof the key algorithm; valid choices are hmac-md5, hmac-sha1, hmac-sha224, hmac-sha256,\nhmac-sha384, or hmac-sha512. If hmac is not specified, the default is hmac-md5; if MD5\nwas disabled, the default is hmac-sha256.\n",
                    "flag": "-y"
                },
                {
                    "name": "NOTE:",
                    "content": "Only  the  -k option should be used, rather than the -y option, because with -y the shared\nsecret is supplied as a command-line argument in clear text. This may be  visible  in  the\noutput from ps1 or in a history file maintained by the user's shell.\n"
                }
            ]
        },
        "QUERY OPTIONS": {
            "content": "dig provides a number of query options which affect the way in which lookups are made and the\nresults displayed. Some of these set or reset flag bits in the query header,  some  determine\nwhich  sections of the answer get printed, and others determine the timeout and retry strate‐\ngies.\n\nEach query option is identified by a keyword preceded by a plus sign (+). Some  keywords  set\nor reset an option; these may be preceded by the string no to negate the meaning of that key‐\nword. Other keywords assign values to options, like the timeout interval. They have the  form\n+keyword=value.  Keywords  may  be abbreviated, provided the abbreviation is unambiguous; for\nexample, +cd is equivalent to +cdflag. The query options are:\n",
            "subsections": [
                {
                    "name": "+aaflag, +noaaflag",
                    "content": "This option is a synonym for +aaonly, +noaaonly.\n"
                },
                {
                    "name": "+aaonly, +noaaonly",
                    "content": "This option sets the aa flag in the query.\n"
                },
                {
                    "name": "+additional, +noadditional",
                    "content": "This option displays [or does not display] the additional section of a reply. The  de‐\nfault is to display it.\n"
                },
                {
                    "name": "+adflag, +noadflag",
                    "content": "This  option sets [or does not set] the AD (authentic data) bit in the query. This re‐\nquests the server to return whether all of the answer and authority sections have been\nvalidated  as  secure,  according to the security policy of the server. AD=1 indicates\nthat all records have been validated as secure and the answer is not  from  a  OPT-OUT\nrange.  AD=0  indicates  that  some  part of the answer was insecure or not validated.\nThis bit is set by default.\n"
                },
                {
                    "name": "+all, +noall",
                    "content": "This option sets or clears all display flags.\n"
                },
                {
                    "name": "+answer, +noanswer",
                    "content": "This option displays [or does not display] the answer section of a reply. The  default\nis to display it.\n"
                },
                {
                    "name": "+authority, +noauthority",
                    "content": "This  option  displays [or does not display] the authority section of a reply. The de‐\nfault is to display it.\n"
                },
                {
                    "name": "+badcookie, +nobadcookie",
                    "content": "This option retries the lookup with a new server cookie if a BADCOOKIE response is re‐\nceived.\n"
                },
                {
                    "name": "+besteffort, +nobesteffort",
                    "content": "This  option attempts to display the contents of messages which are malformed. The de‐\nfault is to not display malformed answers.\n"
                },
                {
                    "name": "+bufsize[=B]",
                    "content": "This option sets the UDP message buffer size advertised using EDNS0 to B  bytes.   The\nmaximum  and minimum sizes of this buffer are 65535 and 0, respectively.  +bufsize re‐\nstores the default buffer size.\n"
                },
                {
                    "name": "+cd, +cdflag, +nocdflag",
                    "content": "This option sets [or does not set] the CD (checking disabled) bit in the  query.  This\nrequests the server to not perform DNSSEC validation of responses.\n"
                },
                {
                    "name": "+class, +noclass",
                    "content": "This option displays [or does not display] the CLASS when printing the record.\n"
                },
                {
                    "name": "+cmd, +nocmd",
                    "content": "This option toggles the printing of the initial comment in the output, identifying the\nversion of dig and the query options that have been applied. This option always has  a\nglobal  effect;  it  cannot be set globally and then overridden on a per-lookup basis.\nThe default is to print this comment.\n"
                },
                {
                    "name": "+coflag, +co, +nocoflag, +noco",
                    "content": "This option sets [or does not set] the CO (Compact denial of existence Ok) EDNS bit in\nthe  query.   If  set, it tells servers that Compact Denial of Existence responses are\nacceptable when replying to queries.  The default is +nocoflag.\n"
                },
                {
                    "name": "+comments, +nocomments",
                    "content": "This option toggles the display of some comment lines in the output, with  information\nabout  the packet header and OPT pseudosection, and the names of the response section.\nThe default is to print these comments.\n\nOther types of comments in the output are not affected by this option, but can be con‐\ntrolled  using other command-line switches. These include +cmd, +question, +stats, and\n+rrcomments.\n"
                },
                {
                    "name": "+cookie=####, +nocookie",
                    "content": "This option sends [or does not send] a COOKIE EDNS option, with an optional value. Re‐\nplaying  a  COOKIE  from  a previous response allows the server to identify a previous\nclient. The default is +cookie.\n\n+cookie is also set when +trace is set to better emulate the default  queries  from  a\nnameserver.\n"
                },
                {
                    "name": "+crypto, +nocrypto",
                    "content": "This  option  toggles  the display of cryptographic fields in DNSSEC records. The con‐\ntents of these fields are unnecessary for debugging most  DNSSEC  validation  failures\nand  removing  them makes it easier to see the common failures. The default is to dis‐\nplay the fields. When omitted, they are replaced by the string [omitted]  or,  in  the\nDNSKEY case, the key ID is displayed as the replacement, e.g. [ key id = value ].\n"
                },
                {
                    "name": "+defname, +nodefname",
                    "content": "This option, which is deprecated, is treated as a synonym for +search, +nosearch.\n"
                },
                {
                    "name": "+dns64prefix, +nodns64prefix",
                    "content": "Lookup IPV4ONLY.ARPA AAAA and print any DNS64 prefixes found.\n"
                },
                {
                    "name": "+dnssec, +do, +nodnssec, +nodo",
                    "content": "This  option requests that DNSSEC records be sent by setting the DNSSEC OK (DO) bit in\nthe OPT record in the additional section of the query.\n"
                },
                {
                    "name": "+domain=somename",
                    "content": "This option sets the search list to contain the single domain somename, as  if  speci‐\nfied  in a domain directive in /etc/resolv.conf, and enables search list processing as\nif the +search option were given.\n"
                },
                {
                    "name": "+dscp=value",
                    "content": "This option formerly set the DSCP value used when sending a query.  It  is  now  obso‐\nlete, and has no effect.\n"
                },
                {
                    "name": "+edns[=#], +noedns",
                    "content": "This option specifies the EDNS version to query with. Valid values are 0 to 255.  Set‐\nting the EDNS version causes an EDNS query to be sent.  +noedns clears the  remembered\nEDNS version. EDNS is set to 0 by default.\n"
                },
                {
                    "name": "+ednsflags[=#], +noednsflags",
                    "content": "This  option  sets  the  must-be-zero EDNS flags bits (Z bits) to the specified value.\nDecimal, hex, and octal encodings are accepted. Setting a named flag (e.g. DO, CO)  is\nsilently ignored. By default, no Z bits are set.\n"
                },
                {
                    "name": "+ednsnegotiation, +noednsnegotiation",
                    "content": "This  option enables/disables EDNS version negotiation. By default, EDNS version nego‐\ntiation is enabled.\n"
                },
                {
                    "name": "+ednsopt[=code[:value]], +noednsopt",
                    "content": "This option specifies the EDNS option with code point code and an optional payload  of\nvalue  as  a  hexadecimal string. code can be either an EDNS option name (for example,\nNSID or ECS) or an arbitrary numeric value. +noednsopt clears the EDNS options  to  be\nsent.\n"
                },
                {
                    "name": "+expire, +noexpire",
                    "content": "This option sends an EDNS Expire option.\n"
                },
                {
                    "name": "+fail, +nofail",
                    "content": "This option indicates that named should try [or not try] the next server if a SERVFAIL\nis received. The default is to not try the next server, which is the reverse of normal\nstub resolver behavior.\n"
                },
                {
                    "name": "+fuzztime[=value], +nofuzztime",
                    "content": "This  option  allows the signing time to be specified when generating signed messages.\nIf a value is specified it is the seconds since 00:00:00 January 1, 1970 UTC  ignoring\nleap  seconds.   If no value is specified 1646972129 (Fri 11 Mar 2022 04:15:29 UTC) is\nused.  The default is +nofuzztime and the current time is used.\n"
                },
                {
                    "name": "+header-only, +noheader-only",
                    "content": "This option sends a query with a DNS header without a question section. The default is\nto add a question section. The query type and query name are ignored when this is set.\n"
                },
                {
                    "name": "+https[=value], +nohttps",
                    "content": "This  option indicates whether to use DNS over HTTPS (DoH) when querying name servers.\nWhen this option is in use, the port number defaults to 443.  The  HTTP  POST  request\nmode is used when sending the query.\n\nIf  value is specified, it will be used as the HTTP endpoint in the query URI; the de‐\nfault is /dns-query. So, for  example,  dig  @example.com  +https  will  use  the  URI\nhttps://example.com/dns-query.\n"
                },
                {
                    "name": "+https-get[=value], +nohttps-get",
                    "content": "Similar  to  +https,  except  that  the HTTP GET request mode is used when sending the\nquery.\n"
                },
                {
                    "name": "+https-post[=value], +nohttps-post",
                    "content": "Same as +https.\n"
                },
                {
                    "name": "+http-plain[=value], +nohttp-plain",
                    "content": "Similar to +https, except that HTTP queries will be sent over a non-encrypted channel.\nWhen  this  option is in use, the port number defaults to 80 and the HTTP request mode\nis POST.\n"
                },
                {
                    "name": "+http-plain-get[=value], +nohttp-plain-get",
                    "content": "Similar to +http-plain, except that the HTTP request mode is GET.\n"
                },
                {
                    "name": "+http-plain-post[=value], +nohttp-plain-post",
                    "content": "Same as +http-plain.\n"
                },
                {
                    "name": "+identify, +noidentify",
                    "content": "This option shows [or does not show] the IP address and port number that supplied  the\nanswer,  when  the  +short option is enabled. If short form answers are requested, the\ndefault is not to show the source address and port number of the server that  provided\nthe answer.\n"
                },
                {
                    "name": "+idnin, +noidnin",
                    "content": "This  option  processes [or does not process] IDN domain names on input. This requires\nIDN SUPPORT to have been enabled at compile time.\n\nThe default is to process IDN input when standard output is a tty.  The IDN processing\non  input is disabled when dig output is redirected to files, pipes, and other non-tty\nfile descriptors.\n"
                },
                {
                    "name": "+idnout, +noidnout",
                    "content": "This option converts [or does not convert] puny code on output. This requires IDN SUP‐‐\nPORT to have been enabled at compile time.\n\nThe  default is to process puny code on output when standard output is a tty. The puny\ncode processing on output is disabled when dig output is redirected to  files,  pipes,\nand other non-tty file descriptors.\n"
                },
                {
                    "name": "+ignore, +noignore",
                    "content": "This option ignores [or does not ignore] truncation in UDP responses instead of retry‐\ning with TCP. By default, TCP retries are performed.\n"
                },
                {
                    "name": "+keepalive, +nokeepalive",
                    "content": "This option sends [or does not send] an EDNS Keepalive option.\n"
                },
                {
                    "name": "+keepopen, +nokeepopen",
                    "content": "This option keeps [or does not keep] the TCP socket open between queries,  and  reuses\nit rather than creating a new TCP socket for each lookup. The default is +nokeepopen.\n"
                },
                {
                    "name": "+multiline, +nomultiline",
                    "content": "This  option  prints  [or  does not print] records, like the SOA records, in a verbose\nmulti-line format with human-readable comments. The default is to print each record on\na single line to facilitate machine parsing of the dig output.\n"
                },
                {
                    "name": "+ndots=D",
                    "content": "This  option sets the number of dots (D) that must appear in name for it to be consid‐\nered absolute. The default value is that defined using the ndots statement in /etc/re‐‐\nsolv.conf,  or  1  if  no ndots statement is present. Names with fewer dots are inter‐\npreted as relative names, and are searched for in the domains listed in the search  or\ndomain directive in /etc/resolv.conf if +search is set.\n"
                },
                {
                    "name": "+nsid, +nonsid",
                    "content": "When  enabled,  this  option  includes  an  EDNS name server ID request when sending a\nquery.\n"
                },
                {
                    "name": "+nssearch, +nonssearch",
                    "content": "When this option is set, dig attempts to find the authoritative name servers  for  the\nzone  containing  the  name being looked up, and display the SOA record that each name\nserver has for the zone.  Addresses of servers that did not respond are also printed.\n"
                },
                {
                    "name": "+onesoa, +noonesoa",
                    "content": "When enabled, this option prints only one (starting) SOA  record  when  performing  an\nAXFR. The default is to print both the starting and ending SOA records.\n"
                },
                {
                    "name": "+opcode=value, +noopcode",
                    "content": "When  enabled,  this  option  sets  (restores) the DNS message opcode to the specified\nvalue. The default value is QUERY (0).\n"
                },
                {
                    "name": "+padding=value",
                    "content": "This option pads the size of the query packet using the EDNS Padding option to  blocks\nof  value  bytes.  For  example, +padding=32 causes a 48-byte query to be padded to 64\nbytes. The default block size is 0, which disables padding; the maximum is 512. Values\nare  ordinarily expected to be powers of two, such as 128; however, this is not manda‐\ntory. Responses to padded queries may also be padded, but only if the query  uses  TCP\nor DNS COOKIE.\n"
                },
                {
                    "name": "+qid=value",
                    "content": "This option specifies the query ID to use when sending queries.\n"
                },
                {
                    "name": "+qr, +noqr",
                    "content": "This  option  toggles  the display of the query message as it is sent. By default, the\nquery is not printed.\n"
                },
                {
                    "name": "+question, +noquestion",
                    "content": "This option toggles the display of the question section of a query when an  answer  is\nreturned. The default is to print the question section as a comment.\n"
                },
                {
                    "name": "+raflag, +noraflag",
                    "content": "This  option sets [or does not set] the RA (Recursion Available) bit in the query. The\ndefault is +noraflag. This bit is ignored by the server for QUERY.\n"
                },
                {
                    "name": "+rdflag, +nordflag",
                    "content": "This option is a synonym for +recurse, +norecurse.\n"
                },
                {
                    "name": "+recurse, +norecurse",
                    "content": "This option toggles the setting of the RD (recursion desired) bit in the query.   This\nbit  is set by default, which means dig normally sends recursive queries. Recursion is\nautomatically disabled when the +nssearch or +trace query option is used.\n"
                },
                {
                    "name": "+retry=T",
                    "content": "This option sets the number of times to retry UDP and TCP queries to server to  T  in‐\nstead of the default, 2.  Unlike +tries, this does not include the initial query.\n"
                },
                {
                    "name": "+rrcomments, +norrcomments",
                    "content": "This option toggles the display of per-record comments in the output (for example, hu‐\nman-readable key information about DNSKEY records). The default is not to print record\ncomments unless multiline mode is active.\n"
                },
                {
                    "name": "+search, +nosearch",
                    "content": "This option uses [or does not use] the search list defined by the searchlist or domain\ndirective in resolv.conf, if any. The search list is not used by default.\n\nndots from resolv.conf (default 1), which may  be  overridden  by  +ndots,  determines\nwhether  the name is treated as relative and hence whether a search is eventually per‐\nformed.\n"
                },
                {
                    "name": "+short, +noshort",
                    "content": "This option toggles whether a terse answer is provided. The default is  to  print  the\nanswer  in  a  verbose  form. This option always has a global effect; it cannot be set\nglobally and then overridden on a per-lookup basis.\n"
                },
                {
                    "name": "+showbadcookie, +noshowbadcookie",
                    "content": "This option toggles whether to show the message containing the BADCOOKIE rcode  before\nretrying the request or not. The default is to not show the messages.\n"
                },
                {
                    "name": "+showsearch, +noshowsearch",
                    "content": "This option performs [or does not perform] a search showing intermediate results.\n"
                },
                {
                    "name": "+sigchase, +nosigchase",
                    "content": "This feature is now obsolete and has been removed; use delv instead.\n"
                },
                {
                    "name": "+split=W",
                    "content": "This  option  splits  long  hex-  or  base64-formatted fields in resource records into\nchunks of W characters (where W is rounded up to the nearest multiple of 4).  +nosplit\nor  +split=0 causes fields not to be split at all. The default is 56 characters, or 44\ncharacters when multiline mode is active.\n"
                },
                {
                    "name": "+stats, +nostats",
                    "content": "This option toggles the printing of statistics: when the query was made, the  size  of\nthe reply, etc. The default behavior is to print the query statistics as a comment af‐\nter each lookup.\n"
                },
                {
                    "name": "+subnet=addr[/prefix-length], +nosubnet",
                    "content": "This option sends [or does not send] an EDNS CLIENT-SUBNET option with  the  specified\nIP address or network prefix.\n\ndig  +subnet=0.0.0.0/0, or simply dig +subnet=0 for short, sends an EDNS CLIENT-SUBNET\noption with an empty address and a source prefix-length of zero, which signals  a  re‐\nsolver  that  the  client's  address  information must not be used when resolving this\nquery.\n"
                },
                {
                    "name": "+tcflag, +notcflag",
                    "content": "This option sets [or does not set] the TC (TrunCation) bit in the query.  The  default\nis +notcflag. This bit is ignored by the server for QUERY.\n"
                },
                {
                    "name": "+tcp, +notcp",
                    "content": "This  option indicates whether to use TCP when querying name servers.  The default be‐\nhavior is to use UDP unless a type any or ixfr=N query is requested, in which case the\ndefault  is  TCP.  AXFR queries always use TCP. To prevent retry over TCP when TC=1 is\nreturned from a UDP query, use +ignore.\n"
                },
                {
                    "name": "+timeout=T",
                    "content": "This option sets the timeout for a query to T seconds. The default timeout is  5  sec‐\nonds. An attempt to set T to less than 1 is silently set to 1.\n"
                },
                {
                    "name": "+tls, +notls",
                    "content": "This  option  indicates  whether to use DNS over TLS (DoT) when querying name servers.\nWhen this option is in use, the port number defaults to 853.\n"
                },
                {
                    "name": "+tls-ca[=file-name], +notls-ca",
                    "content": "This option enables remote server TLS certificate validation for DNS transports, rely‐\ning  on  TLS.  Certificate  authorities certificates are loaded from the specified PEM\nfile (file-name). If the file is not specified,  the  default  certificates  from  the\nglobal certificates store are used.\n"
                },
                {
                    "name": "+tls-certfile=file-name, +tls-keyfile=file-name, +notls-certfile, +notls-keyfile",
                    "content": "These  options set the state of certificate-based client authentication for DNS trans‐\nports, relying on TLS. Both certificate chain file and private key file  are  expected\nto be in PEM format.  Both options must be specified at the same time.\n"
                },
                {
                    "name": "+tls-hostname=hostname, +notls-hostname",
                    "content": "This  option  makes dig use the provided hostname during remote server TLS certificate\nverification. Otherwise, the DNS server name is used. This option  has  no  effect  if\n+tls-ca is not specified.\n"
                },
                {
                    "name": "+topdown, +notopdown",
                    "content": "This  feature is related to dig +sigchase, which is obsolete and has been removed. Use\ndelv instead.\n"
                },
                {
                    "name": "+trace, +notrace",
                    "content": "This option toggles tracing of the delegation path from the root name servers for  the\nname  being  looked  up.  Tracing is disabled by default. When tracing is enabled, dig\nmakes iterative queries to resolve the name being looked up. It follows referrals from\nthe  root  servers,  showing  the answer from each server that was used to resolve the\nlookup.\n\nIf @server is also specified, it affects only the initial query for the root zone name\nservers.\n\n+dnssec  is  also set when +trace is set, to better emulate the default queries from a\nname server.\n"
                },
                {
                    "name": "+tries=T",
                    "content": "This option sets the number of times to try UDP and TCP queries to server to T instead\nof the default, 3. If T is less than or equal to zero, the number of tries is silently\nrounded up to 1.\n"
                },
                {
                    "name": "+trusted-key=####",
                    "content": "This option formerly specified trusted keys for use with dig +sigchase.  This  feature\nis now obsolete and has been removed; use delv instead.\n"
                },
                {
                    "name": "+ttlid, +nottlid",
                    "content": "This option displays [or does not display] the TTL when printing the record.\n"
                },
                {
                    "name": "+ttlunits, +nottlunits",
                    "content": "This  option  displays  [or  does not display] the TTL in friendly human-readable time\nunits of s, m, h, d, and w, representing seconds, minutes,  hours,  days,  and  weeks.\nThis implies +ttlid.\n"
                },
                {
                    "name": "+unknownformat, +nounknownformat",
                    "content": "This  option  prints all RDATA in unknown RR type presentation format (RFC 3597).  The\ndefault is to print RDATA for known types in the type's presentation format.\n"
                },
                {
                    "name": "+vc, +novc",
                    "content": "This option uses [or does not use] TCP when querying name servers. This alternate syn‐\ntax  to  +tcp is provided for backwards compatibility. The vc stands for \"virtual cir‐\ncuit.\"\n"
                },
                {
                    "name": "+yaml, +noyaml",
                    "content": "When enabled, this option prints the responses (and, if +qr is in use, also the outgo‐\ning queries) in a detailed YAML format.\n"
                },
                {
                    "name": "+zflag, +nozflag",
                    "content": "This option sets [or does not set] the last unassigned DNS header flag in a DNS query.\nThis flag is off by default.\n"
                }
            ]
        },
        "MULTIPLE QUERIES": {
            "content": "The BIND 9 implementation of dig supports specifying multiple queries on the command line (in\naddition  to supporting the -f batch file option). Each of those queries can be supplied with\nits own set of flags, options, and query options.\n\nIn this case, each query argument represents an individual query in the  command-line  syntax\ndescribed  above.  Each  consists  of  any  of the standard options and flags, the name to be\nlooked up, an optional query type and class, and any query options that should be applied  to\nthat query.\n\nA  global set of query options, which should be applied to all queries, can also be supplied.\nThese global query options must precede the first tuple of name, class, type, options, flags,\nand  query  options  supplied  on the command line. Any global query options (except +cmd and\n+short options) can be overridden by a query-specific set of query options. For example:\n\ndig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr\n\nshows how dig can be used from the command line to make  three  lookups:  an  ANY  query  for\nwww.isc.org,  a  reverse  lookup  of  127.0.0.1, and a query for the NS records of isc.org. A\nglobal query option of +qr is applied, so that dig shows the initial query it made  for  each\nlookup. The final query has a local query option of +noqr which means that dig does not print\nthe initial query when it looks up the NS records for isc.org.\n",
            "subsections": []
        },
        "IDN SUPPORT": {
            "content": "If dig has been built with IDN (internationalized domain name) support,  it  can  accept  and\ndisplay  non-ASCII  domain  names.  dig appropriately converts character encoding of a domain\nname before sending a request to a DNS server or displaying a reply from the server.  To turn\noff IDN support, use the parameters +idnin and +idnout, or define the IDNDISABLE environment\nvariable.\n",
            "subsections": []
        },
        "RETURN CODES": {
            "content": "dig return codes are:\n\n0      DNS response received, including NXDOMAIN status\n\n1      Usage error\n\n8      Couldn't open batch file\n\n9      No reply from server\n\n10     Internal error\n",
            "subsections": []
        },
        "FILES": {
            "content": "",
            "subsections": [
                {
                    "name": "/etc/resolv.conf",
                    "content": ""
                },
                {
                    "name": "${HOME}/.digrc",
                    "content": ""
                }
            ]
        },
        "SEE ALSO": {
            "content": "delv(1), host(1), named(8), dnssec-keygen(8), RFC 1035.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "There are probably too many query options.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Internet Systems Consortium\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "2026, Internet Systems Consortium\n\n\n\n\n9.18.39-0ubuntu0.22.04.4-Ubuntu              2025-08-13                                       DIG(1)",
            "subsections": []
        }
    },
    "summary": "dig - DNS lookup utility",
    "flags": [
        {
            "flag": "-4",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-6",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-b",
            "long": null,
            "arg": null,
            "description": "This option sets the source IP address of the query. The address must be a valid ad‐ dress on one of the host's network interfaces, or \"0.0.0.0\" or \"::\". An optional port may be specified by appending #port."
        },
        {
            "flag": "-c",
            "long": null,
            "arg": null,
            "description": "This option sets the query class. The default class is IN; other classes are HS for Hesiod records or CH for Chaosnet records."
        },
        {
            "flag": "-f",
            "long": null,
            "arg": null,
            "description": "This option sets batch mode, in which dig reads a list of lookup requests to process from the given file. Each line in the file should be organized in the same way it would be presented as a query to dig using the command-line interface."
        },
        {
            "flag": "-h",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-k",
            "long": null,
            "arg": null,
            "description": "This option tells dig to sign queries using TSIG or SIG(0) using a key read from the given file. Key files can be generated using tsig-keygen. When using TSIG authentica‐ tion with dig, the name server that is queried needs to know the key and algorithm that is being used. In BIND, this is done by providing appropriate key and server statements in named.conf for TSIG and by looking up the KEY record in zone data for SIG(0)."
        },
        {
            "flag": "-m",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-p",
            "long": null,
            "arg": null,
            "description": "This option sends the query to a non-standard port on the server, instead of the de‐ fault port 53. This option is used to test a name server that has been configured to listen for queries on a non-standard port number."
        },
        {
            "flag": "-q",
            "long": null,
            "arg": null,
            "description": "This option specifies the domain name to query. This is useful to distinguish the name from other arguments."
        },
        {
            "flag": "-r",
            "long": null,
            "arg": null,
            "description": "useful for scripts that need predictable behavior."
        },
        {
            "flag": "-t",
            "long": null,
            "arg": null,
            "description": "This option indicates the resource record type to query, which can be any valid query type. If it is a resource record type supported in BIND 9, it can be given by the type mnemonic (such as NS or AAAA). The default query type is A, unless the -x option is supplied to indicate a reverse lookup. A zone transfer can be requested by specifying a type of AXFR. When an incremental zone transfer (IXFR) is required, set the type to ixfr=N. The incremental zone transfer contains all changes made to the zone since the serial number in the zone's SOA record was N. All resource record types can be expressed as TYPEnn, where nn is the number of the type. If the resource record type is not supported in BIND 9, the result is displayed as described in RFC 3597."
        },
        {
            "flag": "-u",
            "long": null,
            "arg": null,
            "description": "stead of milliseconds."
        },
        {
            "flag": "-v",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-x",
            "long": null,
            "arg": null,
            "description": "This option sets simplified reverse lookups, for mapping addresses to names. The addr is an IPv4 address in dotted-decimal notation, or a colon-delimited IPv6 address. When the -x option is used, there is no need to provide the name, class, and type argu‐ ments. dig automatically performs a lookup for a name like 94.2.0.192.in-addr.arpa and sets the query type and class to PTR and IN respectively. IPv6 addresses are looked up using nibble format under the IP6.ARPA domain."
        },
        {
            "flag": "-y",
            "long": null,
            "arg": null,
            "description": "This option signs queries using TSIG with the given authentication key. keyname is the name of the key, and secret is the base64-encoded shared secret. hmac is the name of the key algorithm; valid choices are hmac-md5, hmac-sha1, hmac-sha224, hmac-sha256, hmac-sha384, or hmac-sha512. If hmac is not specified, the default is hmac-md5; if MD5 was disabled, the default is hmac-sha256."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "delv",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/delv/1/json"
        },
        {
            "name": "host",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/host/1/json"
        },
        {
            "name": "named",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/named/8/json"
        },
        {
            "name": "dnssec-keygen",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/dnssec-keygen/8/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "DNS lookup utility.",
        "examples": [
            {
                "description": "Lookup the IP(s) associated with a hostname (A records)",
                "command": "dig +short {{example.com}}"
            },
            {
                "description": "Get a detailed answer for a given domain (A records)",
                "command": "dig +noall +answer {{example.com}}"
            },
            {
                "description": "Query a specific DNS record type associated with a given domain name",
                "command": "dig +short {{example.com}} {{A|MX|TXT|CNAME|NS}}"
            },
            {
                "description": "Specify an alternate DNS server to query and optionally use DNS over TLS (DoT)",
                "command": "dig {{+tls}} @{{1.1.1.1|8.8.8.8|9.9.9.9|...}} {{example.com}}"
            },
            {
                "description": "Perform a reverse DNS lookup on an IP address (PTR record)",
                "command": "dig -x {{8.8.8.8}}"
            },
            {
                "description": "Find authoritative name servers for the zone and display SOA records",
                "command": "dig +nssearch {{example.com}}"
            },
            {
                "description": "Perform iterative queries and display the entire trace path to resolve a domain name",
                "command": "dig +trace {{example.com}}"
            },
            {
                "description": "Query a DNS server over a non-standard [p]ort using the TCP protocol",
                "command": "dig +tcp -p {{port}} @{{dns_server_ip}} {{example.com}}"
            }
        ]
    }
}