Commands · Command
CommandLinuxmacOS
dig
dig [@server] name [type]Queries DNS servers and displays detailed results — the modern, scriptable replacement for nslookup on Linux/macOS.
// FLAGS
+shortprint just the answer, no verbose headers@serverquery a specific DNS server instead of the system default-xreverse lookup, IP to hostname// EXAMPLE
dig +short example.com — prints just the resolved IP address(es) for example.com.
// GOTCHA
Plain dig example.com prints a lot of header/footer detail that can look alarming to someone expecting a single answer — +short is usually what people actually want for a quick check.
// RELATED COMMANDS