How to Flush DNS Cache on macOS and Linux

Akkireddy
Mac O’Clock
Published in
1 min readJun 26, 2020

--

Photo by Goran Ivos on Unsplash

macOS

  1. Open the terminal window.

If you’re using Mac OS Sierra, X El Capitan, X Mavericks, X Mountain Lion, or X Lion, enter the following command:

sudo killall -HUP mDNSResponder

  1. To flush DNS cache on Mac OS X Yosemite, enter the statement:

sudo discoveryutil udnsflushcaches

Linux

  1. Ubuntu does not cache DNS entries. However, if you have manually installed a DNS service, such as name service caching daemon then you can periodically flush the DNS cache. The method provided below will show you how you can flush your DNS cache.
  2. Press Ctrl+Alt+T together to open the terminal window.
  3. The next step is to enter the following command to clear DNS cache files on init.d subdirectory:

sudo /etc/init.d/nscd restart

--

--

Akkireddy
Mac O’Clock

#DevOps — #AWS — #Cloud enthusiast.. Views are my own.