Articles on: Cloud Hosting

How do I flush my DNS cache in Linux?

When a computer needs to do a DNS lookup it will first look in its internal cache. If the computer is not refreshing its DNS cache in a timely manner, you may need to manually clear the DNS information.



In order to run a command to flush the local DNS cache you must first open a command terminal window. There are a number of ways to flush your cache depending on your Linux distribution and the version of that distribution. Here are some of the most command commands in order of prevalence:



sudo systemd-resolve --flush-caches




sudo resolvectl flush-caches




sudo killall -USR2 systemd-resolved




sudo killall -HUP dnsmasq




sudo systemctl restart dnsmasq

Updated on: 27/02/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!