How to Fix bash whois command not found in Minimal Linux

The error message “bash: whois: command not found” surfaces in Linux terminal sessions when network administrators and security analysts attempt to query domain name registrations, autonomous system numbers (ASNs), and IP address block allocations using the whois client. Lightweight cloud virtual machines, minimal container templates, and stripped-down server images exclude the whois utility by default to keep installation footprints compact.

Install whois on Debian, Ubuntu, and Linux Mint

On Debian-derived distributions, the whois client is maintained in the standard software repositories:

  1. Update your local APT repository index:
    sudo apt update
  2. Install the whois package binary:
    sudo apt install -y whois
  3. Confirm successful installation by verifying the binary version:
    which whois
    whois --version

Install whois on RHEL, CentOS, Rocky Linux, and Fedora

Enterprise Red Hat derivatives distribute the WHOIS protocol client through DNF and YUM:

  1. On Fedora, RHEL 8/9, Rocky Linux, and AlmaLinux:
    sudo dnf install -y whois
  2. On legacy CentOS 7 servers:
    sudo yum install -y whois
  3. Verify package installation details:
    rpm -qi whois

Install whois in Alpine Linux Docker Containers

Alpine Linux container images support the whois client via the standard package repository:

  1. Update the Alpine package repository index:
    apk update
  2. Install the standalone whois client package:
    apk add whois
  3. In automated Dockerfile build manifests, include the package during image compilation:
    RUN apk add --no-cache whois

Query Specific Registrar and TLD Servers Directly

If you encounter restrictive rate limits from default redirecting WHOIS servers:

  1. Query a specific regional Internet registry (RIR) directly using the -h flag:
    whois -h whois.iana.org example.com
  2. For IP address block ownership lookups:
    whois -h whois.arin.net 1.1.1.1

Installing the whois package restores comprehensive domain registration lookups, IP network allocations, and ASN ownership diagnostics across minimal Linux installations.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.