← All commands
Topic hub Networking
Windows Linux Networking

Windows ipconfig /flushdns equivalent in Linux

Clears locally cached DNS records, forcing fresh lookups on the next DNS request.

Windows ipconfig /flushdns
Linux equivalents
Debian/Ubuntu apt / systemd-resolved
sudo resolvectl flush-caches
Fedora dnf / systemd-resolved
sudo resolvectl flush-caches
Arch pacman / systemd-resolved
sudo resolvectl flush-caches

Overview

What this command does

Clears locally cached DNS records, forcing fresh lookups on the next DNS request.

Migration tip: The command varies by distro. On modern Ubuntu/Debian use systemd-resolve --flush-caches. Verify DNS settings with resolvectl status.

Practical tasks

Common use cases

Flush the DNS resolver cache

Clears locally cached DNS records, forcing fresh lookups on the next DNS request.

systemd-resolve --flush-caches

Flush DNS (systemd-resolved)

resolvectl flush-caches

Alternative on newer systems

sudo systemctl restart systemd-resolved

Restart DNS resolver service

Ready to run

Copyable Linux commands

Review paths, device names, package names and permissions before running any command.

sudo systemd-resolve --flush-caches
resolvectl flush-caches
resolvectl status
cat /etc/resolv.conf

Walkthrough

Examples with explanations

# Windows: ipconfig /flushdns

# Modern Ubuntu/Debian:
sudo systemd-resolve --flush-caches
resolvectl flush-caches  # alternative

# Check DNS settings:
resolvectl status
cat /etc/resolv.conf

Reference

Common options and variations

Command or optionUse
systemd-resolve --flush-cachesFlush DNS (systemd-resolved)
resolvectl flush-cachesAlternative on newer systems
sudo systemctl restart systemd-resolvedRestart DNS resolver service
resolvectl statusView current DNS servers per interface
cat /etc/resolv.confView DNS config file

Distro differences

Debian/Ubuntu vs Fedora vs Arch

This command can differ by distro defaults or package manager.

DistributionPackage manager / baseEquivalent commandDifference to notice
Debian/Ubuntu apt / systemd-resolved sudo resolvectl flush-caches Works when systemd-resolved is handling DNS cache.
Fedora dnf / systemd-resolved sudo resolvectl flush-caches Fedora systems may use systemd-resolved depending on edition/configuration.
Arch pacman / systemd-resolved sudo resolvectl flush-caches Only applies if systemd-resolved is enabled; otherwise flush the cache daemon you installed.

Keep learning

Related Networking commands