ahost
Lookup host IP addresses
TLDR
Print an A or AAAA record associated with a hostname or IP address
Display some extra debugging output
Display the record with a specified type
SYNOPSIS
host [options] name [server]
PARAMETERS
-a
Equivalent to -v -t ANY. Displays all available DNS records (A, AAAA, MX, NS, SOA, etc.) for a given name.
-c class
Specify the query class. The default and most common class is IN (Internet). Other classes like CH (Chaosnet) or HS (Hesiod) are less common.
-C
Check consistency. This option attempts to compare SOA records from different authoritative servers for the zone to identify inconsistencies.
-d
Enable debugging output. Provides more detailed information about the query process and DNS responses.
-l
List all hosts in a domain by attempting a zone transfer (AXFR). This operation is often restricted by DNS server configurations for security reasons.
-N ndots
Set the number of dots that must appear in name for it to be considered an absolute name. Used in conjunction with the resolver's search path configuration.
-r
Perform a non-recursive query. The queried server will return whatever information it possesses without attempting to query other DNS servers.
-R number
Set the number of retries for UDP queries (default is 1). Specifies how many times host should attempt to re-send a query if no response is received.
-s server
Specify the DNS server to query. This can be an IP address or a hostname. If not specified, the system's default DNS servers (from /etc/resolv.conf) are used.
-t type
Specify the query type. Common types include A (IPv4 address), AAAA (IPv6 address), MX (mail exchange), NS (name server), SOA (start of authority), TXT (text), SRV (service record), CNAME (canonical name), PTR (pointer for reverse lookups), or ANY (all records).
-T
Use TCP mode for queries. This is useful for large responses that might be truncated over UDP, such as zone transfers or large records.
-v
Enable verbose output, displaying more details about the query, response, and name server information.
-W wait
Set the wait time (timeout) in seconds for a reply (default is 5 seconds). Specifies how long host will wait for a response before retrying or failing.
-w
Wait forever for a reply. This disables the query timeout, causing host to wait indefinitely for a response.
-4
Force host to use IPv4 only for sending queries and resolving addresses.
-6
Force host to use IPv6 only for sending queries and resolving addresses.
DESCRIPTION
The host command is a simple command-line utility used for performing DNS (Domain Name System) lookups. Its primary function is to translate hostnames to IP addresses and vice-versa, but it can also retrieve various other DNS record types such as NS (Name Server), MX (Mail Exchange), SOA (Start of Authority), SRV (Service Record), and more.
It is part of the bind-utils (or bind9-host on Debian/Ubuntu) package and is a standard tool used for quick network diagnostics, verifying DNS configurations, and for scripting. Compared to ping, host provides more detailed information specifically about hostname resolution, and it is often preferred over the older nslookup command for automated tasks and scripting due to its more consistent and parseable output format.
CAVEATS
The exact output format of host can sometimes vary slightly between different versions of the BIND utilities package across various Linux distributions.
The -l (zone transfer) option very frequently fails in practice on public or production DNS servers, as zone transfers (AXFR) are commonly disabled due to security concerns. For more advanced or in-depth DNS troubleshooting, particularly when tracing recursive query paths or examining detailed DNS packet information, the dig command typically offers superior capabilities and control.
CLARIFICATION: <I>AHOST</I> VS <I>HOST</I>
The command ahost is not a standard, widely recognized Linux command found in common distributions. This analysis describes the functionalities and usage of the common DNS lookup utility host, which is a standard component of the BIND utilities package available on virtually all Linux and Unix-like operating systems.
It is highly probable that ahost on your system is either a custom script, an alias configured to execute host, or a command specific to a particular specialized environment or application. Always verify the actual command's behavior and refer to its specific documentation if ahost is present on your system.
HISTORY
The host command is an integral part of the BIND (Berkeley Internet Name Domain) suite, which was originally developed at the University of California, Berkeley. It was created as a simpler, more robust, and scripting-friendly alternative to the older nslookup utility.
nslookup was often criticized for its less consistent output and interactive-by-default behavior, making it cumbersome for automation. host, along with dig, was designed to address these shortcomings, providing predictable output and a command-line interface better suited for shell scripting. Its development has progressed alongside the BIND DNS server software, integrating improvements in DNS protocol support, performance, and security features, establishing it as a ubiquitous tool for DNS diagnostics on Unix-like systems.