How to Flush the DNS Cache in Ubuntu & Why You Might Need To

Joel Lee 07-10-2016

Domain Name Servers are one of the backbones of the internet. Without them, the entire system of domain names wouldn’t work and we’d have to navigate the web using straight IP addresses — not my idea of fun, if you ask me.


Whenever you access a domain name, your system keeps a record of which IP address that domain points to (this is called a cache). This makes your next access to that domain much faster because you don’t have to look it up, which could take seconds.

But sometimes your local domain name cache falls out of sync with the actual mapping of a domain name to IP address. That’s why sometimes you can’t access a website even though the website isn’t down — especially if that website has moved servers recently.

When that happens, you need to flush your DNS cache. Fortunately, this can be done with a simple terminal command on Ubuntu and other Debian systems:

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

There are other DNS-related tricks that might prove useful to you, such as optimizing DNS for faster internet speeds How to Optimize Your DNS for Faster Internet "The Internet is just a series of tubes" as one man so wisely stated. Unfortunately, it’s not as simple as that. There’s a complex architecture that supports the Internet, and data packets need to travel... Read More and changing your DNS for improved online security How To Change Your DNS Servers & Improve Internet Security Imagine this - you wake up one beautiful morning, pour yourself a cup of coffee, and then sit down at your computer to get started with your work for the day. Before you actually get... Read More , so look into that when you can.

Did this work? If you’re using a DNS service, let us know which one you’re using in a comment down below!


Related topics: DNS, Troubleshooting, Ubuntu.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

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

  1. Markus Müller
    October 7, 2017 at 7:32 am

    Works well with Ubuntu 17.04.
    Thank you

  2. dragonmouth
    October 8, 2016 at 2:22 pm

    "2. A VM Basically Accomplishes the Same Objective"
    But it increases the complexity of the setup. Also, the OS running in the VM does not have access to all the hardware resources.

    The one, major fact to remember about dual booting is to install Windows before any other OS. Other OSs (BSD, Linux, QNX) will recognize the existence of Windows and set up the boot loader accordingly. Windows insists on being the one and only OS on the drive and will overwrite the MBR with its own version, effectively negating access to the other OSs.

  3. Dan Marusin
    October 8, 2016 at 8:09 am

    I was badly searching about this. I do not know about how to flush the DNS cache in UBUNTU. As I love UBUNTU because of it fast working habit I was not supposed to change my OS. Thanks a lot for sharing about it. Really a very helpful post for sure.