Resolve a hostname to its IP address
Build a paste-ready command, then review its compatibility and effects before running it.
dig +short example.comCompatibility
Linux + macOSVerified for Linux, macOS using posix, bash, zsh syntax.
Operational knowledgereview due 2027-01-19
Requirementsdigdig must be installed and available on PATH.Network accessThe target must be reachable from the current environment.
Version supportdig Current supported releasesVerified for linux, macos using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signals93.184.216.34Representative successful output; values vary with the selected target and system state.
Known errorsdig: command not founddig is missing or is not available on PATH.
Verifydig +short {{domain}}The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01digDNS lookup toolQueries DNS records for a name.
02+shortConcise outputPrints only the useful answer values instead of the full DNS report.
03example.comHostnameReplace this with the domain you want to resolve.
Example input
dig +short example.com
Example output
93.184.216.34
Illustrative output — exact values vary by system and data.
Runbooks
Official sources