What is Host command?
The Host command is a tool with a command-line interface for Domain Name System lookups. You can use it straight from the Terminal application since it is usually pre-installed on Linux-based and Unix-based OSes. You can use it on Ubuntu, CentOS, macOS, or others, without any difference in syntax or functionality?
Who created the command?
The Host command was created by the Internet Systems Consortium (ISC), and it offers the Host command under the ISC license, which is a permissive free software license similar to the BSD one.
Purpose of the Host command
You can use the command for:
- DNS probing and see information about a particular domain name.
- Find the IP address or IP addresses of a host. Both IPv4 and IPv6 can be seen.
- Do reverse DNS lookups and see to whom does an IP address belongs.
- Check DNS records like SOA, A, AAAA, CNAME, MX, and NS.
How to use the command?
For macOS users
You can easily start using the command on macOS:
- Press the Command+Space buttons, and you will see a search bar.
- Write Terminal, and you will see the Terminal app. Open it.
- Now, you can use it by typing “host domain.com”, “host IP address” or use the command with some additional option like “host -t DNSrecordType domain.com”. See the options below for more precise probing.
For Linux users
The command is available through the Terminal application (Linux Shell):
- Press Ctrl+Alt+T on Ubuntu or Alt+F2 for another Linux distro.
- Inside the Terminal, you can use different hosts commands like “host domain.com”, “host IP address” or use the command with some additional option like “host -t DNSrecordType domain.com”. See the options below for more precise probing.
Host command options
We have shortlisted the list of options available for the Host command, but if you want to see the complete one, just type “host” in your Terminal application and see the full list.
It will also show you the command’s syntax.
|-a||The “-a” stands for all types of DNS records. It is the same as “-t ANY”.|
|-i||The “-i” is used for Reverse DNS probes. You can also use it directly with only an IP address.|
|-R||UDP packets retry number.|
|-t||With “-t”, you can set the type of DNS record you want to see, like mx for MX record, ns for NS, and so on.|
|-w||Wait without a time limit for queries.|
|-W||Wait a set time in seconds for queries.|
Host command examples
If you want to use these examples, please go ahead, but change the IP addresses or domain names with the right ones for your needs.
|Host command exmaples||Description|
|host site.com||Shows the IPv4 and IPv6 of site.com (A and AAAA records)|
|host -t ns site.com||Shows the NS records for the domain.|
|host -t cname site.com||Shows the CNAME records.|
|host -t txt site.com||Shows the TXT records.|
|host -t mx site.com||Shows the MX records.|
|host -a site.com||Shows all DNS records.|
|host -i 111.333.666.1111||Reverse lookup and check which the host is.|
|Host site.com ns2.site.com||Checks the ns2 (the second name server) of site.com|
Alternatives to Host command
There are many alternatives to the Host command, and some of the most popular are:
- Nslookup command is extremely easy to use, and it is available not only on Linux or macOS but also on Windows. Great, always on the hand tool.
- Dig command – Some people prefer it over the Host command. It has a lot of extra options, and you can use it to see all types of DNS records.
- Ping command – A limit functionality network tool for checking host. You can ping a host or IP address and see how it responds—no chance to see different DNS record types with it.
Check the different software available and learn to use it. It is always useful to have a DNS probing tool on hand if you own different sites.