The host command is a simple, lightweight utility for performing Domain Name System (DNS) lookups, translating human-readable hostnames into IP addresses and vice versa. However, when working in stripped-down Linux installations, minimal virtual machine appliances, or lightweight container base images (such as Ubuntu, Debian, or Alpine), attempting to run the command often results in the error: bash: host: command not found. Because minimal server images exclude optional networking diagnostics to conserve disk space, the utility must be provisioned via your package manager.
Install host on Debian, Ubuntu, and Linux Mint
On Debian-based distributions, the host binary is provided by the bind9-host package:
- Update your local package index:
sudo apt update - Install the
bind9-hostpackage:sudo apt install -y bind9-host - Alternatively, if you require a full suite of DNS lookup tools (including
digandnslookup), installdnsutils:sudo apt install -y dnsutils - Verify installation by performing a test resolution:
host google.com
Install host on RHEL, CentOS, Rocky Linux, and Fedora
Enterprise Linux distributions bundle the host command inside the bind-utils package:
- On Fedora, Rocky Linux, AlmaLinux, or RHEL:
sudo dnf install -y bind-utils - On legacy CentOS 7 servers:
sudo yum install -y bind-utils - Confirm that the binary is available in your PATH:
which host
Install host in Minimal Alpine Linux Containers
Alpine Linux containers provide the BIND host lookup tool through APK:
- Update the package database:
apk update - Install the
bind-toolspackage:apk add bind-tools - Test DNS resolution:
host -t A cloudflare.com - In automated Dockerfile recipes, append the package to the installation layer:
RUN apk add --no-cache bind-tools
Perform Basic DNS Lookups Using host
Once installed, host offers rapid diagnostics for DNS record verification:
- Query Mail Exchange (MX) records:
host -t MX example.com - Perform reverse DNS (PTR) lookup on an IP address:
host 8.8.8.8 - Query against a specific nameserver:
host example.com 1.1.1.1
Installing the bind9-host or bind-utils package restores instant DNS diagnostics and resolves the “command not found” error across minimal Linux systems.