Mastering whois on Ubuntu: Domain, IP & ASN Lookup

Overview

Investigating domain ownership, registrant metadata, and IP address allocations represents a foundational daily routine for network administrators and security engineers in Linux environments. This practical guide walks through the end-to-end operation of the whois utility on Ubuntu 24.04—spanning initial binary deployment, dissecting key query flags, and crafting efficient shell pipelines for everyday infrastructure audits.

Installing the whois Client and Querying Basic Domain Metadata

Before querying registry databases, update the local APT cache and install the standard network client package.

Updating package indices and installing whois

Verify that the executable has been properly linked and check the installed release version on your system.

Checking installed whois client version

The whois tool fetches registration records directly from regional internet registries and domain registrars, detailing administrative ownership, sponsoring registrars, and lifecycle timestamps. Pairing the lookup command with a regular-expression filter via grep isolates critical attributes without wading through dense text outputs.

⚙️ [Key Command Options]

-h : Directs the query to an explicitly defined WHOIS server hostname rather than falling back to default routing heuristics.
-p : Overrides the target communication port (standard WHOIS operations use port 43).
-a : Forces queries directed to the American Registry for Internet Numbers (ARIN) to traverse all secondary mirror databases.
-i : Triggers an inverse query matching a designated attribute index across RIPE-compatible registries.
-r : Instructs RIPE-style databases to explicitly suppress associated administrative contact records from the payload.

Filtering primary domain registration attributes

Investigating Public IP Allocations and ASN Routing Blocks

Execute whois 8.8.8.8 | grep -E "NetRange|CIDR|OrgName|Country" to profile the network block, parent organization, and physical jurisdiction of Google’s public resolver.
The parsed output outlines the exact CIDR routing prefix along with confirmation that the netblock is administered by Google LLC within the United States (US).

Querying IP network range and organization details

Run whois 1.1.1.1 | grep -E "NetRange|Organization|Country" to inspect Cloudflare’s recursive DNS endpoint.
Because regional registries like APNIC utilize differing key names compared to ARIN, schema variations may occasionally return empty values when matching against rigid patterns; adjusting regex filters to match the authoritative RIR’s schema is vital.

Inspecting APNIC-managed IP block registration

Run whois AS15169 | grep -E "ASNumber|ASName|OrgName" to pull routing entity details assigned to a specific Autonomous System Number.
The targeted output confirms that AS15169 operates as a global autonomous routing identifier registered directly to Google LLC (under the handle GOOGLE).

Resolving Autonomous System Number metadata

Targeting Authoritative Registries (-h) and Suppressing Disclaimers (-H)

Execute whois -h whois.iana.org example.com to query the top-level root registry directly via IANA (whois.iana.org), bypassing intermediate registrar delegations.
This approach produces a raw, authoritative delegation trace detailing root namespace records and initial creation dates (1992-01-01) free of reseller clutter.

Directing lookup to the IANA root registry

Run whois -H example.com | head -n 25 to strip out the lengthy, boilerplate legal terms of service normally appended to WHOIS responses using the -H flag, capping output to the first 25 lines.
This delivers clean visibility over domain status flags, sponsoring registrars, and authoritative nameservers without distracting legal disclaimers.

Suppressing repetitive registry legal disclaimers

Real-World Pipelines: Automating Expiry Dates and Nameserver Extraction

Execute whois google.com | grep -i "Registry Expiry Date" | awk '{print "Expiration Date:", $4}' to isolate the expiration timestamp string and format it with awk for automated reporting.
This concise pipeline slices through multi-paragraph responses to output cleanly formatted lifecycle timestamps (such as the target dates in September 2028).

Extracting domain expiration dates with awk

Run whois -h whois.verisign-grs.com google.com | grep -i "Name Server" | sort -u to probe Verisign’s primary .com registry engine, collect all associated nameserver entries, and eliminate duplicates.
The resulting list displays the full cluster of active public nameservers (NS1.GOOGLE.COM through NS4.GOOGLE.COM) in an alphabetically sorted, production-ready format.

Deduplicating authoritative nameservers via Verisign registry

This concludes our walkthrough of the Linux whois client, covering core queries, targeted registry options, and automation pipelines on Ubuntu. Integrating these command structures into your operational scripts will streamline network auditing, IP footprinting, and incident triage across your infrastructure.