How can I clear the DNS cache on Ubuntu 16.04 / 18.04?
Linode
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.