Clear Ubuntu DNS Cache

I have tried many methods to clear the cache for ubuntu and it didn't work for me. I tried these two methods and it seems to be working just fine on ubuntu.


Method 1:

Type the following command:

dig @8.8.8.8 example.com

You can replace 8.8.8. example.com with nameserver address.

e.g. dig @ns2579.hostgator.com

This should update the DNS and you'll be able to see website updated (if there is any problem or was parked page).

Method 2:

Ubuntu 12.04 does  cache DNS using dnsmasq.

Use the following to clear the cache:

sudo kill -HUP $(pgrep dnsmasq)

This will also do the same thing like method 1. Both these command line options work for the ubuntu and you can use either one of them.