Clear/Flush DNS Cache on Windows 10, Linux and MacOS

When a system DNS works for a long time, it saves many records that cause DNS works slowly or not working correctly. To flush DNS cache, you need to clear DNS records from your system. You can do it with the command line in command prompt and Windows Powershell and Terminal on MacOS systems.

The flush DNS command is the tool you need to clear and flush DNS cache. Just open the command line interface and dump the correct DNS cache then remove it.

The Domain Name System (DNS) is a hierarchical decentralized naming system for computers, services, or other resources connected to the Internet or a private network. It associates various information with domain names assigned to each of the participating entities. Most prominently, it translates more readily memorized domain names to the numerical IP addresses needed for locating and identifying computer services and devices with the underlying network protocols.

Clear and Flush DNS Cache with command line:

  1. Open a command line interface
  2. Display DNS Records
  3. Flush DNS Cache
  4. Check DNS Records

To flush DNS cache just follow the step by step guide. It works the same on all Windows operating systems, but different on various MacOS and Linux distributions.

Related: Install and Configure DNS Server on Windows Server.

How to View DNS Cache

To view DNS cache on Windows systems, just type “ipconfig /displaydns” in command prompt.

  1. Press Windows+R to open the Run.
  2. Type “cmd” and press enter to open the command prompt.
  3. Now type “ipconfig /displaydns” to view DNS cache and records.

The ipconfig /displaydns result is like this.

There are too many DNS records on my system. But this is just an example of DNS cache in Windows system.

Flush DNS Cache in Windows 10

To clear Windows 10 DNS cache and records, type the “ipconfig /flushdns” command in command prompt or PowerShell.

Clear DNS Records and Flush DNS Cache in Windows 10 - Technig
Clear DNS Records and Flush DNS Cache in Windows 10 – Technig

 

That’s good, the DNS cache removed successfully. This command works the same on all Windows client and Windows server machines.

Check DNS Records

Now if you check again you can not find any DNS records.

Yes, the system can not display the DNS records. Becuase there is no DNS record cached yet.

Flush DNS Cache on MacOS

Flushing the DNS in Mac OS X is an easy process, but the steps taken will depend on which version of OS X you are running. For the different version of MacOS operating system use the following command to clear and flush DNS cache.

MacOS Sierra, OS X El Capitan, Mac OS X Yosemite, Mac OS X Mavericks, Mac OS X Mountain Lion, Mac OS X Mountain Lion, and Mac OS X Lion.

If you are running Mac OS X 10.11, you need to follow the below steps:

  1. Open up the command terminal.
  2. Run the command sudo killall -HUP mDNSResponder

Mac OS X Snow Leopard.

If you are running Mac OS X 10.6, you need to follow the below steps:

  1. Open up a command terminal.
  2. Run the command sudo dscacheutil -flushcache

Mac OS X Leopard and below.

If you are running Mac OS X 10.5.1 or below, you need to follow the below steps:

  1. Open a command terminal.
  2. Run the command sudo lookupd -flushcache

Flush DNS Cache on Linux

If you are running the nscd Name Service Cache Daemon and wish to flush your DNS cache, then you will need to do the following.

  1. Open up a command terminal (either as root or run step 2 with sudo).
  2. Run the command /etc/init.d/nscd restart
  3. Now, you just have to restart the NSCD. To do, type the following command
Finally, ask your question related to DNS server from comment section.

You might also like

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.