dig: Difference between revisions

From Leechfinger
Jump to navigationJump to search
Qais (talk | contribs)
Qais (talk | contribs)
Line 30: Line 30:
=== Find the ip of a host ===
=== Find the ip of a host ===
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
$ dig amazon.com
$ dig amazon.com | grep -A 1 --color 'ANSWER SECTION'
;; ANSWER SECTION:
amazon.com.            842    IN      A      205.251.242.103
</syntaxhighlight>
</syntaxhighlight>
Look at the "ANSWER SECTION", it has name, TTL in seconds, IN (class or internet), A (record type), IP.
[[Category:Commands]]
[[Category:Commands]]

Revision as of 16:33, 16 May 2025

Install dig package

Dig is part of package bind9-dnsutils.

$ apt-file list bind9-dnsutils
bind9-dnsutils: /usr/bin/delv             
bind9-dnsutils: /usr/bin/dig
bind9-dnsutils: /usr/bin/dnstap-read
bind9-dnsutils: /usr/bin/mdig
bind9-dnsutils: /usr/bin/nslookup
bind9-dnsutils: /usr/bin/nsupdate
bind9-dnsutils: /usr/share/doc/bind9-dnsutils/changelog.Debian.gz
bind9-dnsutils: /usr/share/doc/bind9-dnsutils/copyright
bind9-dnsutils: /usr/share/man/man1/delv.1.gz
bind9-dnsutils: /usr/share/man/man1/dig.1.gz
bind9-dnsutils: /usr/share/man/man1/dnstap-read.1.gz
bind9-dnsutils: /usr/share/man/man1/mdig.1.gz
bind9-dnsutils: /usr/share/man/man1/nslookup.1.gz
bind9-dnsutils: /usr/share/man/man1/nsupdate.1.gz
$ apt install bind9-dnsutils

Reverse lookup

This option sets simplified reverse lookups, for mapping addresses to names.

$ dig -x 54.239.28.85

Check dig version

$ dig -v

Find the ip of a host

$ dig amazon.com | grep -A 1 --color 'ANSWER SECTION'
;; ANSWER SECTION:
amazon.com.             842     IN      A       205.251.242.103

Look at the "ANSWER SECTION", it has name, TTL in seconds, IN (class or internet), A (record type), IP.