Best SEO and PPC Tool - Extended Free Trial  GO!
How to Clear DNS Cache on Linux

How to Clear DNS Cache on Linux

Last modified: November 22, 2020


Sometimes you need to clear the DNS cache on your Linux computer. This is very similar to clearing the DNS cache on a Mac or Windows computer. In this article we look at the ways you can clear the cache.

What is DNS Caching

Before you learn how to clear the DNS Cache, you must understand what the DNS is and the caching system. Understanding them both will help you know why it needs to be done and when it might be necessary.

A DNS (Domain Name System) is the index of all the websites that can be found on the internet. The record includes the name of the website the IP address of where they’re hosted. Therefore, the DNS is like a telephone directory of all the websites online.

The cache is local files that are stored on your computer that give you the basic building blocks for rendering a website. It is like a snapshot of a website. This is to speed up loading of a website page and improve the experience of your time online.

The DNS Cache is the stored information on your website of the DNS. However, sometimes this information is out of date or corrupted. This is when you might need to clear your computer’s DNS cache.

How to Clear the DNS Cache on Linux (Ubuntu)

Here are the steps to clear your DNS cache on Linux computers. The process is very similar to that you would find for MacOS and Windows.

Step 1 – Terminal

Linux OS users the Terminal system as the command line interface. To open this, you will need to click on ‘Activities’ in the top-left corner of the desktop. This will provide a search bar. Enter in the search query ‘terminal’ and it will find and launch the program for you.

Step 2 – Code

Once you’ve got the command line interface open, you can execute the command:

sudo systemd-resolve –flushcaches

You will be prompted to enter your password. When you’ve entered that information, the command should execute, clearing the cache.

Other Distributions

If you’re not using the Linux distribution Ubuntu, then you can clear the DNS cache by finding the command line interface and then entering in this line of code:

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

Once this has been entered, you can then see that the cache has been cleared.

Final Word: How to Clear DNS Cache on Linux

When it comes to clearing your DNS Cache on your Linux OS, then there are no problems. It takes just two steps to clear the cache. Several errors might be solved through this operation and it is always a good skill to have.

If you’re looking to learn more core skills about operating a WordPress website, then check out the other articles that are within our WordPress FAQ pages. If you’re looking at WordPress hosting, you can also check out our hosting pages here.

Save 4 Later
Email liked links to yourself