Press the Windows key on your keyboard and type cmd. Right-click Command Prompt in the search results. Click Run as administrator. Click Yes to confirm.
If you just want to see the contents of your DNS cache without flushing it, run the command ipconfig /displaydns instead. This command also displays entries from your hosts file. If your PC is a part of an Active Directory network, you may also need to run the command ipconfig /registerdns if you can’t resolve other hostnames on your network. If you’re still having trouble accessing websites after clearing your DNS cache, you may also need to clear your browser cache.
Open Finder, click the Go menu, select Utilities, and then select Terminal. Click the Spotlight icon (the magnifying glass) at the top-right corner of your desktop, type terminal, and then double-click Terminal. You can also press ⌘ Command+Space to open Spotlight.
You can also press ⌘ Command+Space to open Spotlight.
Big Sur (macOS 11) and later: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder El Capitan, Sierra, High Sierra, Mojave, & Catalina: sudo killall -HUP mDNSResponder Yosemite: sudo discoveryutil udnsflushcaches Lion, Mountain Lion, & Mavericks: sudo killall -HUP mDNSResponder
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
sudo killall -HUP mDNSResponder
sudo discoveryutil udnsflushcaches
sudo killall -HUP mDNSResponder
If prompted, enter your password to run the command. This will be the password you enter when logging in to your Mac. Terminal won’t show your keystrokes as you type, but it will detect them. If you’re still having trouble accessing websites, check out our guide to fixing common computer network issues. You can also try resetting your network.
Ubuntu & Debian: Type sudo systemd-resolve –flush-caches and press Enter. In newer version of Ubuntu you may have to use command sudo resolvectl flush-caches instead. To make sure the command worked, run the command sudo systemd-resolve –statistics to make sure the cache is empty. In newer version of Ubuntu you may have to use command sudo resolvectl statistics instead. RedHat & CentOS: Type systemctl restart dnsmasq. service and press Enter. You won’t see any confirmation or errors, so don’t worry if you don’t get any feedback.
Type sudo systemd-resolve –flush-caches and press Enter. In newer version of Ubuntu you may have to use command sudo resolvectl flush-caches instead. To make sure the command worked, run the command sudo systemd-resolve –statistics to make sure the cache is empty. In newer version of Ubuntu you may have to use command sudo resolvectl statistics instead.
Type systemctl restart dnsmasq. service and press Enter. You won’t see any confirmation or errors, so don’t worry if you don’t get any feedback.
Don’t be alarmed if you don’t see a prompt or confirmation, as everything happens quietly in the background. If you’re still having trouble accessing websites, you can also try clearing your browser cache,