How to Flush DNS cache in Ubuntu

DNS Cache stores the IP Addresses of Web Servers that host the website. Some times you need to Flush, Reset or clear your DNS cache to resolve the new ip address of your favorite website or to take effect /etc/hosts file changes.

To flush DNS cache on ubuntu, you need to open terminal and run the below command.

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

or

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


This should work very well on Ubuntu 14.04 LTS and later. For older versions you need to install nscd (Name Service Cache Daemon). Name Service Cache Daemon is a daemon which handles passwd, group and host lookups for running programs and caches the results for the next query. You should install this package only if you use slow Services like LDAP, NIS or NIS+.

To install nscd on ubuntu, you need to open a terminal and run the below command.

sudo apt-get update

Then type the below command and hit enter to install the nscd.

sudo aptitude install nscd

To flush DNS cache, open terminal and run the below command.

sudo /etc/init.d/nscd restart

If you want to uninstall nscd just run the below command in terminal.

sudo aptitude remove nscd
Suggested Read:  How to install Oracle JDK 8 on Linux Mint

You may also like...

1 Response

  1. infometr says:

    Hey, great post, really well written. You should post more about this.

Leave a Reply

Your email address will not be published. Required fields are marked *

*