How to Flush DNS Cache on macOS and Linux
- 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
- To flush DNS cache on Mac OS X Yosemite, enter the statement:
sudo discoveryutil udnsflushcaches
- 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.
- Press Ctrl+Alt+T together to open the terminal window.
- The next step is to enter the following command to clear DNS cache files on init.d subdirectory:
sudo /etc/init.d/nscd restart