Search the CLDY knowledge base

Updated on January 25, 2023

How To Flush DNS Cache on Linux Computer

When there are changes in your network environment, such as a new router or major updates to your business website, it is highly recommended to flush DNS cache so your applications and sites will load properly.

You can do it on your Linux in just 3 easy steps:

Note: Saved passwords, browser histories, and website login credentials may also be cleared when flushing DNS cache. Make sure to have a copy of your logins and passwords, or bookmark your preferred links before proceeding to flush DNS cache.

1. Click on Ctrl + Alt + T from your keyboard. The Terminal window should appear on your screen.

linux terminal emulation
This screenshot is from Flickr

 

2. Based on the type of service of your Linux , type in the corresponding command:

  • sudo /etc/init.d/nscd restart (for NCSD)
  • sudo /etc/init.d/dnsmasq restart (for Dnsmasq)
  • (for BIND, there are different commands you can try to use)
    • sudo /etc/init.d/named restart
    • sudo rndc restart
    • sudo rndc exec
  • Note: Enter your password if prompted.

 

3. You may experience a slow down or a temporary stop in the service, but that should be okay. The service may relaunch and confirm that the flush DNS cache process was successfully completed.

Still can't find what you're looking for?