host command in Linux system is used for DNS (Domain Name System) lookup operations. In simple words, this command is used to find the IP address of a particular domain name or if you want to find out the domain name of a particular IP address the host command becomes handy. You can also find more specific details of a domain by specifying the corresponding option along with the domain name.
host [-aCdlriTWV] [-c class] [-N ndots] [-t type] [-W time] [-R number] [-m flag] hostname [server]
host command without any option: It will print the general syntax of the command along with the various options that can be used with the host command as well as gives a brief description about each option.
Different options with the host command:
- host domain_name: This will print the IP address details of the specified domain.
- host IP_Address: This will display the domain details of the specified IP Address.
- -a or -v: It used to specify the query type or enables the verbose output.
host -a geeksforgeeks.org
- -t : It is used to specify the type of query.
host -t ns geeksforgeeks.org
Example 2: To print SOA record
host -t SOA geeksforgeeks.org
Example 3: To print txt record
host -t txt geeksforgeeks.org
- -C : In order to compare the SOA records on authoritative nameservers.
host -C geeksforgeeks.org
- -R : In order to specify the number of retries you can do in case one try fails. If anyone try succeeds then the command stops.
host -R 3 geeksforgeeks.org
- -l :In order to list all hosts in a domain.For this command to work you need to be either an admin or a node server.
host -l geeksforgeeks.org
- Create a shared Folder between Host OS and Guest OS ( Virtual Box)
- Node | urlObject.host API
- HTTP headers | Host
- HTTP header | X-Forwarded-Host
- How to style the host element of the component in AngularJS?
- 'IPCS' command in Linux with examples
- select command in Linux with examples
- Sed Command in Linux/Unix with examples
- ZIP command in Linux with examples
- SORT command in Linux/Unix with examples
- Cat command in Linux with examples
- Head command in Linux with examples
- Tail command in Linux with examples
- wc command in Linux with examples
- tar command in Linux with examples
- atrm command in Linux with examples
- bc command in Linux with examples
- AWK command in Unix/Linux with examples
- tr command in Unix/Linux with examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.