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.
01Command
$ resolvectl flush-caches02What 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
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- resolvectl(1) — Linux manual pageEvidence: 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
One command that prints every interface with its state and IPv4/IPv6 addresses in a short table — the modern, memorable replacement for digging through `ifconfig` or the verbose `ip addr` output.
The routing table is the first thing to check when traffic leaves the wrong interface or the gateway seems dead — and `ip route show` is the quick, modern way to read it.
The fastest way to answer 'is the firewall blocking me?' — netcat in scan mode attempts one TCP connection and prints whether it succeeded.