How to Flush DNS Cache on Ubuntu 13.04, 12.10

Last updated: July 18, 2013

This simple tutorial will show you how to flush or clear your system’s DNS records on Ubuntu 13.04 Raring and 12.10 Quantal.


  • Flush DNS records on Ubuntu 13.04 or Ubuntu 12.10
  • Enjoy!

To get started, press Ctrl+Alt+T to open a terminal window.

Open Terminal to run commands

Then run command to flush dns:

sudo /etc/init.d/dns-clean restart

You can also use this command:

sudo /etc/init.d/networking force-reload

In addition, to flush nscd dns cache:

sudo /etc/init.d/nscd restart

To flush dnsmasq dns cache:

sudo /etc/init.d/dnsmasq restart


I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via Buy me a coffee:

3 responses to How to Flush DNS Cache on Ubuntu 13.04, 12.10

  1. Using “service” command instead of “/etc/init-d/” is tidier. From man service: service runs a System V init script or upstart job in as predictable an environment as possible, removing most environment variables and with the current working directory set to /.

  2. Thank you ~~

  3. Mr Ji m

    i unable to clear DNS Cache in Linux Ubuntu 14.04 and my net is getting disconnectivity ver often automatically
    i am tried the following commands
    sudo /etc/init.d/dns-clean restart
    sudo /etc/init.d/networking force-reload
    sudo /etc/init.d/nscd restart
    sudo /etc/init.d/dnsmasq restart.

    but no use