How to Flush the Local DNS Cache in Linux Server

January 12, 2024 / Domain Name

This article explains how to flush the local DNS cache in a Linux server. If your computer encounters difficulty accessing a particular website or server, it could be credited to a corrupted local DNS cache.

Follow the steps-

  1. Access the command line by opening your terminal.
  2. Using the su command, log in as the root user-
    user@host:~$ su 
    Password: (type your root user password here) 
    root@host: 
  3. Restart the name service cache daemon (NSCD)-
    root@host: /etc/init.d/nscd restart
  4. NSCD, which stands for Name Service Caching Daemon, is a commonly used DNS caching application in Linux.
  5. If you have NSCD installed, you can clear the local DNS cache for the current user by running the following command in your terminal or shell. To flush the local DNS cache for the current user-
    nscd –i hosts
  6. To flush the local DNS cache for all users-
    nscd -I hosts

Note: The name service cache daemon (NSCD) may not come pre-installed on your Linux system. You can install it using your distribution’s package manager – use yum for RedHat-based distributions like Fedora and CentOS, or apt-get for Debian-based distributions such as Ubuntu and Kubuntu. 

This way, you can flush the local DNS cache in the Linux server. If you liked our article then you will surely love our support. Additionally, you can discover How To Manage DNS Zone Editor in cPanel

Leave a Reply

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