John Sanchez
John Sanchez

Categories

  • snippets

Tags

  • snippet
  • RVM
  • ruby

When updating a website’s DNS records I often find the following command line commands useful.

dig domainname.com
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

What are those commands and why are they useful?

If you know about DNS records, you know that updating them will update the DNS servers around the world. Now, what can happen is that the DNS servers near you are updated but your computer’s DNS records aren’t. They’ll probably get updated the next time you restart your computer or within a few hours.

If you’re actively developing a website and you’re waiting on your DNS cache to update… It can be a real pain!

The following command will pull the DNS records to see if your records have been updated. This doesn’t use the same cache that your browser uses. So, often times, it’ll pull up the most up-to-date information.

dig domainname.com

Then, we use the following to clear your computer’s DNS cache.

sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

If you’d like more details about exactly what each command does, consult the man pages.

For example:

man dig
man dscacheutil
man mDNSResponder