# Systemd: flushing the DNS cache

First off I want to say, that Systemd is quite new to me and I always used the old and classic init systems like OpenRC (which is still available on Gentoo—if someone cares about that more than I do).

Now let’s start right away, flushing the DNS cache on a linux box using Systemd is not that complicated, but the correct commands should be known.

And this post is all about that:

sudo systemd-resolve --flush-caches


You could also use sudo resolvectl flush-caches if you like or prefer.

Now verify the empty cache:

systemd-resolve --statistics


I usually do not need to flush my computers DNS caches, but fiddling with my firewall at home made me use this very often last weeks.