Flushing your DNS cache in Mac OS X and Linux

 

Overview

You can flush the DNS cache on a macOS or Linux operating system by running a command in a terminal on your computer.

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

How do I flush my DNS in macOS?

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

[local]$ sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder

How do I flush my 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?