DNS Commands
Overview
Common DNS lookup and troubleshooting commands for network diagnostics.
Code
nslookup
# query nameserver for domain IP (bypasses cache)
nslookup [domain.com] [ns server]
# check local IP cache
nslookup [domain.com]
# see debug information (TTL, etc.)
nslookup -debug [domain.com]Clear DNS Cache
# linux (ubuntu/debian)
sudo apt-get install nscd
sudo /etc/init.d/nscd restart
# alternative using systemd-resolved
sudo systemd-resolve --flush-caches
# windows
ipconfig /flushdnsdig Commands
# basic lookup
dig example.com
# query specific record type
dig example.com MX
dig example.com TXT
dig example.com A
dig example.com AAAA
# short output
dig +short example.com
# query specific nameserver
dig @8.8.8.8 example.com
# trace DNS resolution path
dig +trace example.comAppendix
Note created on 2025-12-23 and last modified on 2025-12-23.
See Also
Backlinks
(c) No Clocks, LLC | 2025