Flush the DNS cache with `resolvectl flush-caches`

On systemd-based Linux (Ubuntu, Fedora, Debian 12+), the local DNS stub cache is managed by systemd-resolved — and the command to clear it is easy to forget because it changed from systemd-resolve.

Linuxcachesystemd-resolvedDNStroubleshootingLow risk
Run `resolvectl flush-caches` to clear all DNS caches held by systemd-resolved, then verify with `resolvectl statistics`.

01Command

Command
$ resolvectl flush-caches

02What it does

systemd-resolved caches every DNS answer locally, so after changing a DNS record or switching networks you may keep getting the old IP. `resolvectl flush-caches` drops all cached entries immediately (an alias is `resolvectl flush-caches` variant `systemd-resolve --flush-caches` on older releases). Because it only drops cache entries, the command is safe to run any number of times.

03Risk

RiskLow risk
RequirementsRequires systemd-resolved (default on Ubuntu, Fedora and most modern systemd distros)

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • resolvectl(1) — Linux manual page
    man7.org · technical · 2026-09-17
    Evidence: Documents `resolvectl flush-caches` which flushes all DNS caches of systemd-resolved, and `resolvectl statistics` to view cache size

Last verified: 2026-09-17 · Category: Network

06Related solutions