6 ms·
I never really got why people use `dig`. Its interface and output is awkward, and it seems all of its functionality can be more easily performed with `host`, wh
by tmsbrg 5y ago
I never really got why people use `dig`. Its interface and output is awkward, and it seems all of its functionality can be more easily performed with `host`, which doesn't feel the need to print stuff like:
; <<>> DiG 9.16.20 <<>> -r jvns.ca
;; global options: +cmd
;; Got answer:
just try `host goo.gl 1.1.1.1` or `host -t ns google.com` -- it's the output you'd expect without all the verbosity.
- dmarinus 5y agoWhat I've noticed is that people like the name of "dig". It has some advantages though (not described in this tutorial) like tracing and setting the DNS TTL but those are really edge cases. Host is indeed much more convenient!
- johnchristopher 5y agoWell, today I learned of `host`. Thanks !
- e12e 5y agoDig is/was part of bind - and I believe it output is conformant with textual representation from the rfc(s): https://datatracker.ietf.org/doc/html/rfc1035.html#section-5.1 https://datatracker.ietf.org/doc/html/rfc1035.html#section-5...
- ciupicri 5y agohost is also part of BIND: # rpm -q -f `which host` bind-utils-9.16.23-1.fc35.x86_64
- e12e 5y agoSure, but they are different tools: https://bind9.readthedocs.io/en/latest/manpages.html#host-dns-lookup-utility https://bind9.readthedocs.io/en/latest/manpages.html#host-dn... > host is a simple utility for performing DNS lookups. It is normally used to convert names to IP addresses and vice versa. When no arguments or options are given, host prints a short summary of its command-line arguments and options. https://bind9.readthedocs.io/en/latest/manpages.html#dig-dns-lookup-utility https://bind9.readthedocs.io/en/latest/manpages.html#dig-dns... > dig is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried. Most DNS administrators use dig to troubleshoot DNS problems because of its flexibility, ease of use, and clarity of output. Other lookup tools tend to have less functionality than dig. From: https://bind9.readthedocs.io/en/latest/# https://bind9.readthedocs.io/en/latest/#
- colechristensen 5y agoIf you want dig to be less verbose add +short It’s mostly just habit mixed with the difference in inconvenience being quite small Also doesn’t host use the local nss stack while dig exclusively queries dns?
- fanf2 5y agodig allows you to control things like retries and timeouts, choice of udp or tcp, choice of opcode (if you want to synthesise a NOTIFY message, say); it shows you the flags and the authority section so you can debug referrals, and the various EDNS options in case those matter. If you just want the answer then `host` is just fine - I use both of them a lot - but `dig` really shines when you need to get into the guts of the DNS.
- mrweasel 5y agoI have the reverse opinion. Why do people keep insisting on using host, when dig does the same (if not more) and while being so easy to use. Most of my co-worker prefer host, but continue to be supprised when I use dig and features like reverse lookup or dig @some-dns-server. I’m sure that host can do the same, but few seems to know how.
- bspammer 5y agoThe comment you're replying to has an example of using a specific DNS server. As for reverse lookups, it's as simple as host <ip-address>
- Denvercoder9 5y agoDig gives more information, such as TTL and the resolving server. If you also want that information from host, you need to use the `-v` flag, at which point the output is almost as verbose as that from dig.
- axiolite 5y ago> all of its functionality can be more easily performed with `host` I've seen far too many junior admins accidentally change the hostname of a server when checking a DNS record... Dig is verbose by default, which is usually what I want. It can be made as terse as host with the +short option. host -vt SOA google.com is more typing than dig google.com SOA. Neither dig or host is very good for use by other programs.
- nyuszika7h 5y ago> I've seen far too many junior admins accidentally change the hostname of a server when checking a DNS record... Why are they using a root shell for tasks that don't require it in the first place?