dog
dog is an open-source DNS client for the command-line. It has colourful output, supports the DoT and DoH protocols, and can emit JSON.[1]
Documentation
- man 1 'dog' [EN]
Syntax
dog [PARAMETER ...] [NAME ...]
Parameters
Query
- -n ADDRESS, --nameserver=ADDRESS
- ADDRESS of the nameserver to send packets to.
- -q HOST, --query=HOST
- HOST name or domain name to query.
- -t TYPE, --type=TYPE
- TYPE of the DNS record being queried (A, MX, NS...)
Transport
- -H, --https
- Use the DNS-over-HTTPS protocol.
- -S, --tls
- Use the DNS-over-TLS protocol.
Output
- -1, --short
- Short mode: display nothing but the first result.
- --color, --colour=WHEN
- WHEN to colourise the output. This can be always, automatic, or never.
- -J, --json
- Display the output as JSON.
Examples
- Get the IP address of a domain
dog --nameserver='10.0.0.1' 'raysoft.ch'
Output:
A raysoft.ch. 3m04s 217.26.53.37
- Get the IP address of a domain using DoH
dog --https --nameserver='https://cloudflare-dns.com/dns-query' 'raysoft.ch'
Output:
A raysoft.ch. 5m00s 217.26.53.37
- Get the mail servers (MX records) of a domain
dog --nameserver='10.0.0.1' --type='MX' 'raysoft.ch'
Output:
MX raysoft.ch. 5m00s 10 "mx2.mail.hostpoint.ch."
MX raysoft.ch. 5m00s 10 "mx1.mail.hostpoint.ch."