How can I clear the DNS cache on Ubuntu 16.04 / 18.04?

Linode Staff

I noticed some issues with my domain and would like to flush the cache on my server to clear things up. How can I achieve this?

1 Reply

Ubuntu 18.04

The following command will outline your current cache metrics:

sudo systemd-resolve --statistics

This command will clear things up:

sudo systemd-resolve --flush-caches

Ubuntu 16.04

Similiarly, you may run the following command to print your cache statistics:

sudo systemd-resolve --statistics

To actually clear the cache on this distrubution, you'd need to install a DNS utility, nscd :

sudo apt-get install nscd

Then, you may run the following command to flush the cache:

sudo /etc/init.d/networking force-reload

This post from AskUbuntu covers similar steps with few other distribution versions.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct