At The Engaging News Project, we recently upgraded our DNS hosting by moving over to Cloudflare. I wanted to test our site as soon as the nameservers updated to Cloudflare’s to make sure no weird issues popped up.
Fortunately, there’s a handy terminal command for that!
$ nslookup -type=ns jeremyjon.es
nslookup is a command to query nameservers and get all kinds of info back related to the server it’s on and any DNS settings you want to… look-up. Pretty well named command, I guess.
In our case, the
nslookup -type=ns jeremyjon.es command will return all the nameservers of my site, jeremyjon.es.
As of this writing, here’s the response for my domain.
$ nslookup -type=ns jeremyjon.es Server: 18.104.22.168 Address: 22.214.171.124#53 Non-authoritative answer: jeremyjon.es nameserver = ns3.dreamhost.com. jeremyjon.es nameserver = ns1.dreamhost.com. jeremyjon.es nameserver = ns2.dreamhost.com.
To get different information about your DNS, like
A Records, etc, just change out the
ns part of
-type=ns with the record type you’re looking for:
$ nslookup -type=cname jeremyjon.es $ nslookup -type=a jeremyjon.es $ nslookup -type=mx jeremyjon.es
There’s plenty more
nslookup can do that I imagine I’ll never, ever use as a front-end developer, but I’m glad it’s there if I need it.
Clearing out DNS
If you just made a DNS change and want to flush your cache to try to grab the updated nameservers and you’re on OS X 10.10.4 or above, use:
sudo killall -HUP mDNSResponder
Switching servers of any kind is stressful. Hopefully these commands will help your heart beat a little easier when making the switch.