How to clear the local DNS cache in Linux?

Nowadays many Linux distributions do not utilize a local DNS resolver cache, like Windows and Mac OS X. If you do not know whether your distribution has such local DNS caching, we would recommend you to check the official website of your Linux installation.

Here is how to flush the DNS cache in Linux:

  • Open your Terminal.
  • Restart the name service cache daemon by executing this command:

sudo /etc/init.d/nscd restart

There are some cases when the nscd daemon might not be installed. In Ubuntu (and other Debian-based distros) you can install it from your Terminal by executing this command:

sudo apt-get install nscd

For any RedHad-based distributions (such as Fedora, CentOS) you can install the nscd daemon through the yum package manager:

yum install nscd

You find this article useful? Click here to learn more about SiteGround web hosting experts and what else we can do for you!