How to Flush the Local DNS Cache in Linux Server

April 12, 2017 / cPanel & WHM

If your computer has trouble reaching a certain website or server this may be due to a corrupt local DNS cache.

Below are the steps that will show you how to clear your local DNS cache (“flush” it) for Linux Server.

  1. Open your terminal to use the command line.
  2. Login as root user using the su command-
    user@host:~$ su
    Password: (type your root user password here)
  3. Restart the name service cache daemon (NSCD)-
    root@host: /etc/init.d/nscd restart
  4. One of the most commonly used DNS caching Linux applications is NSCD (Name Service Caching Daemon).
  5. If you have NSCD installed, you can clear the local DNS cache by running one of the following commands in your favourite terminal/shell application. To clear the local DNS cache for the current user-
    nscd -i hosts
  6. To clear the local DNS cache for all users-
    nscd -I hosts

[alert] Note: The name service cache daemon (NSCD) might not be installed by default on your Linux. You must be able to install it by using the package manager of your distribution – yum for RedHat-based distributions such as Fedora, CentOS and apt-get for Debian-based distributions such as Ubuntu, Kubuntu.[/alert]

Spread the love