Flushing your DNS cache in Mac OS X and Linux

 

Overview

The following describes how to flush your DNS cache on a macOS or Linux operating system. 

Before proceeding, make sure you've opened a terminal on your computer. This is where you'll type in the command to flush DNS.

Flushing your DNS in macOS

Run the following command to flush DNS in macOS (Sonoma, Ventura, Monterey):

macbook$ sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder

Flushing your DNS in Linux

Most Linux distributions do not use a DNS resolver cache like Windows and macOS. You will instead need to check your Linux distribution's website or forum pages to confirm which particular daemon is installed.

However, a common DNS caching application sometimes used is the Name Service Caching Daemon (nscd). It’s most likely not installed by default so there is no need to flush the cache. But, if you’ve already installed it you can flush the cache by running the following command in a terminal:

[local]$ sudo service nscd restart 

Alternatively, you can try these commands:

[local]$ /etc/rc.d/init.d/nscd stop
[local]$ /etc/rc.d/init.d/nscd start

See also

DreamHost Links

Third-party links

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?