dig (域名信息 groper)

用于查询DNS名称服务器的工具,查找并显示从查询的名称服务器返回的结果,大多数DNS管理员使用dig来解决DNS问题,因为它具有灵活性,易用性和输出清晰度。其他查找工具比dig功能少

语法:

 dig [@server] [-b address] [-c class] [-f filename] [-k filename]
         [-p port#] [-t type] [-x addr] [-y name:key] [-4] [-6]
            [name] [type] [class] [queryopt...]
 dig [-h]

 dig [global-queryopt...] [query...]

选项:

-b address
     设置要查询的源IP地址
     可以通过附加“#”指定可选端口

-c class
     覆盖

-f filename 
     通过读取查找请求列表以批处理模式操作文件中的进程
     该文件包含多个查询,每行一个.
     文件中的每个条目的组织方式应与
     使用命令行界面进行dig的查询相同.

-p port#
    指定一个要查询的端口号,
    默认DNS端口号53.

-4   强制仅使用IPv4.

-6   强制仅使用IPv6.

-t type
    指定要查询的DNS数据类型
    BIND9支持的任何有效查询类型.
    默认查询类型“A”,除非提供-x选项以指示反向查找.
    可以通过指定AXFR的类型来请求区域传输.
    当需要增量区域传输(IXFR)时,类型设置为ixfr = N
    增量区域传输将包含自区域以来对区域所做的更改
    区域SOA记录中的序列号为N

-x addr
    执行逆向域名查询

-k filename
    使用事务签名
    (TSIG密钥文件)签署dig发送的DNS查询及其响应。您还可以
    使用-y选项在命令行上指定TSIG密钥。name是TSIG密钥的名称,key是实际密钥。
    密钥是base-64编码的字符串,通常由dnssec-keygen(8)生成。
    在多用户系统上使用-y选项时应该小心,因为密钥
    可以在ps(1)的输出或shell的历史文件中看到。
    在dig中使用TSIG身份验证时,需要查询名称服务器
    知道正在使用的密钥和算法。在BIND中,这是通过
    在named.conf中提供适当的密钥和服务器语句来完成的

  -h   打印命令行参数和选项的简短摘要.

尽管dig通常与命令行参数一起使用,但它也具有批处理操作模式,用于从文件读取查找请求。与早期版本不同,dig的BIND9实现允许从命令行发出多个查找。

除非告知查询特定名称服务器, 否则dig将尝试/etc/resolv.conf中列出的每个服务器

实例

列出ss64.com的DNS A记录:

$ dig rootopen.com
or 
$ dig rootopen.com A

列出ss64.com的DNS AAAA(ipv6)记录:

$ dig rootopen.com AAAA

使用Google DNS(8.8.8.8)而不是本地缓存列出ss64.com的DNS A记录:

$ dig rootopen.com @8.8.8.8

列出ss64.com的签名记录(SIG记录):

$ dig rootopen.com SIG

列出ss64.com的邮件交换器记录(MX记录):

$ dig rootopen.com MX 

测试DNS解析器的源端口行为:

$ dig +short porttest.dns-oarc.net TXT

dig 命令实例:

linux命令:dig foo.org mx +short +short mx foo.org dig dig foo.org mx +shortrootopen.com
linux命令:dig foo.org mx +short +short mx foo.org dig dig foo.org mx +shortrootopen.com
2018-05-04 02:31:48

linux命令:dig -t txt -c chaos VERSION.BIND @<dns.server.com> @<dns.server.com> VERSION.BIND chaos -c txt -t dig dig -t txt -c chaos VERSION.BIND @<dns.server.com>rootopen.com
linux命令:dig -t txt -c chaos VERSION.BIND @<dns.server.com> @<dns.server.com> VERSION.BIND chaos -c txt -t dig dig -t txt -c chaos VERSION.BIND @<dns.server.com>rootopen.com
2018-03-11 02:32:48

linux命令:dig +short txt <keyword>.wp.dg.cx <keyword>.wp.dg.cx txt +short dig dig +short txt <keyword>.wp.dg.cxrootopen.com
linux命令:dig +short txt <keyword>.wp.dg.cx <keyword>.wp.dg.cx txt +short dig dig +short txt <keyword>.wp.dg.cxrootopen.com
2018-01-11 11:38:48

linux命令:dig +short $HOSTNAME $HOSTNAME +short dig dig +short $HOSTNAMErootopen.com
linux命令:dig +short $HOSTNAME $HOSTNAME +short dig dig +short $HOSTNAMErootopen.com
2018-02-05 11:14:48

linux命令:dig google.com google.com dig dig google.comrootopen.com
linux命令:dig google.com google.com dig dig google.comrootopen.com
2018-01-18 00:54:48

linux命令:dig -x 74.125.45.100 74.125.45.100 -x dig dig -x 74.125.45.100rootopen.com
linux命令:dig -x 74.125.45.100 74.125.45.100 -x dig dig -x 74.125.45.100rootopen.com
2018-01-22 04:10:48

linux命令:dig -x {IP} {IP} -x dig dig -x {IP}rootopen.com
linux命令:dig -x {IP} {IP} -x dig dig -x {IP}rootopen.com
2018-01-20 13:14:48

linux命令:dig +short -x {ip} {ip} -x +short dig dig +short -x {ip}rootopen.com
linux命令:dig +short -x {ip} {ip} -x +short dig dig +short -x {ip}rootopen.com
2018-03-22 12:41:48

linux命令:dig +short myip.opendns.com @resolver1.opendns.com @resolver1.opendns.com myip.opendns.com +short dig dig +short myip.opendns.com @resolver1.opendns.comrootopen.com
linux命令:dig +short myip.opendns.com @resolver1.opendns.com @resolver1.opendns.com myip.opendns.com +short dig dig +short myip.opendns.com @resolver1.opendns.comrootopen.com
2018-02-04 19:05:48

linux命令:dig +short myip.opendns.com @resolver1.opendns.com @resolver1.opendns.com myip.opendns.com +short dig dig +short myip.opendns.com @resolver1.opendns.comrootopen.com
linux命令:dig +short myip.opendns.com @resolver1.opendns.com @resolver1.opendns.com myip.opendns.com +short dig dig +short myip.opendns.com @resolver1.opendns.comrootopen.com
2018-05-05 21:55:48

linux命令:dig +short NS org. org. NS +short dig dig +short NS org.rootopen.com
linux命令:dig +short NS org. org. NS +short dig dig +short NS org.rootopen.com
2018-05-31 12:56:48

linux命令:dig +short @resolver1.opendns.com myip.opendns.com myip.opendns.com @resolver1.opendns.com +short dig dig +short @resolver1.opendns.com myip.opendns.comrootopen.com
linux命令:dig +short @resolver1.opendns.com myip.opendns.com myip.opendns.com @resolver1.opendns.com +short dig dig +short @resolver1.opendns.com myip.opendns.comrootopen.com
2018-05-13 20:41:48

linux命令:dig @208.67.222.222 myip.opendns.com myip.opendns.com @208.67.222.222 dig dig @208.67.222.222 myip.opendns.comrootopen.com
linux命令:dig @208.67.222.222 myip.opendns.com myip.opendns.com @208.67.222.222 dig dig @208.67.222.222 myip.opendns.comrootopen.com
2018-02-02 09:13:48

linux命令:dig @somenameserver.net somedomainname.net axfr axfr somedomainname.net @somenameserver.net dig dig @somenameserver.net somedomainname.net axfrrootopen.com
linux命令:dig @somenameserver.net somedomainname.net axfr axfr somedomainname.net @somenameserver.net dig dig @somenameserver.net somedomainname.net axfrrootopen.com
2018-05-12 19:15:48

linux命令:dig +trace google.com google.com +trace dig dig +trace google.comrootopen.com
linux命令:dig +trace google.com google.com +trace dig dig +trace google.comrootopen.com
2018-06-11 14:06:48

linux命令:dig +short google.com google.com +short dig dig +short google.comrootopen.com
linux命令:dig +short google.com google.com +short dig dig +short google.comrootopen.com
2018-04-06 10:02:48

linux命令:dig hostname a +short +short a hostname dig dig hostname a +shortrootopen.com
linux命令:dig hostname a +short +short a hostname dig dig hostname a +shortrootopen.com
2018-03-26 17:06:48

linux命令:digest -a -v md5 <file-name> <file-name> md5 -v -a digest digest -a -v md5 <file-name>rootopen.com
linux命令:digest -a -v md5 <file-name> <file-name> md5 -v -a digest digest -a -v md5 <file-name>rootopen.com
2017-12-28 00:35:48

linux命令:dig +noall +answer exsample.com exsample.com +answer +noall dig dig +noall +answer exsample.comrootopen.com
linux命令:dig +noall +answer exsample.com exsample.com +answer +noall dig dig +noall +answer exsample.comrootopen.com
2018-05-20 03:19:48

linux命令:dig myip.opendns.com @Resolver1.opendns.com +short +short @Resolver1.opendns.com myip.opendns.com dig dig myip.opendns.com @Resolver1.opendns.com +shortrootopen.com
linux命令:dig myip.opendns.com @Resolver1.opendns.com +short +short @Resolver1.opendns.com myip.opendns.com dig dig myip.opendns.com @Resolver1.opendns.com +shortrootopen.com
2018-05-28 03:35:48

linux命令:dig o-o.myaddr.l.google.com @ns1.google.com txt +short +short txt @ns1.google.com o-o.myaddr.l.google.com dig dig o-o.myaddr.l.google.com @ns1.google.com txt +shortrootopen.com
linux命令:dig o-o.myaddr.l.google.com @ns1.google.com txt +short +short txt @ns1.google.com o-o.myaddr.l.google.com dig dig o-o.myaddr.l.google.com @ns1.google.com txt +shortrootopen.com
2018-04-21 06:40:48

linux命令:dig @resolver1.opendns.com myip.opendns.com | grep ^myip.opendns.com | tr '\t' : | cut -d: -f5 -f5 -d: cut | : '\t' tr | ^myip.opendns.com grep | myip.opendns.com @resolver1.opendns.com dig dig @resolver1.opendns.com myip.opendns.com | grep ^myip.opendns.com | tr '\t' : | cut -d: -f5rootopen.com
linux命令:dig @resolver1.opendns.com myip.opendns.com | grep ^myip.opendns.com | tr '\t' : | cut -d: -f5 -f5 -d: cut | : '\t' tr | ^myip.opendns.com grep | myip.opendns.com @resolver1.opendns.com dig dig @resolver1.opendns.com myip.opendns.com | grep ^myip.opendns.com | tr '\t' : | cut -d: -f5rootopen.com
2018-03-25 08:43:48

linux命令:dig +short -x <ip-address> <ip-address> -x +short dig dig +short -x <ip-address>rootopen.com
linux命令:dig +short -x <ip-address> <ip-address> -x +short dig dig +short -x <ip-address>rootopen.com
2018-04-23 20:03:48

linux命令:dig +short google.com google.com +short dig dig +short google.comrootopen.com
linux命令:dig +short google.com google.com +short dig dig +short google.comrootopen.com
2018-01-25 16:10:48

linux命令:dig +short myip.opendns.com @resolver1.opendns.com @resolver1.opendns.com myip.opendns.com +short dig dig +short myip.opendns.com @resolver1.opendns.comrootopen.com
linux命令:dig +short myip.opendns.com @resolver1.opendns.com @resolver1.opendns.com myip.opendns.com +short dig dig +short myip.opendns.com @resolver1.opendns.comrootopen.com
2018-02-13 03:10:48

linux命令:dig +short <domain> <domain> +short dig dig +short <domain>rootopen.com
linux命令:dig +short <domain> <domain> +short dig dig +short <domain>rootopen.com
2018-03-05 09:24:48

linux命令:dig +short which.opendns.com txt @208.67.220.220 @208.67.220.220 txt which.opendns.com +short dig dig +short which.opendns.com txt @208.67.220.220rootopen.com
linux命令:dig +short which.opendns.com txt @208.67.220.220 @208.67.220.220 txt which.opendns.com +short dig dig +short which.opendns.com txt @208.67.220.220rootopen.com
2017-12-27 04:51:48

linux命令:dig MX example.com +short | cut -d' ' -f2 | sed '1q;d' | xargs dig +short +short dig xargs | '1q;d' sed | -f2 ' -d' cut | +short example.com MX dig dig MX example.com +short | cut -d' ' -f2 | sed '1q;d' | xargs dig +shortrootopen.com
linux命令:dig MX example.com +short | cut -d' ' -f2 | sed '1q;d' | xargs dig +short +short dig xargs | '1q;d' sed | -f2 ' -d' cut | +short example.com MX dig dig MX example.com +short | cut -d' ' -f2 | sed '1q;d' | xargs dig +shortrootopen.com
2018-05-18 16:55:48

linux命令:dig +short -x 127.0.0.1 127.0.0.1 -x +short dig dig +short -x 127.0.0.1rootopen.com
linux命令:dig +short -x 127.0.0.1 127.0.0.1 -x +short dig dig +short -x 127.0.0.1rootopen.com
2018-04-21 21:30:48

Linux的Bash命令行(A-Z排序)