nscd-restart

How to Clear DNS Cache in Ubuntu 12.04

DNS – Domain Name System, is one of the core component of web that provides us human friendly domain names, mapped to computer friendly numeric address (called I.P (Internet Protocol) Address). Each time – when you visit a website – your computer/browser performs a DNS query (searching for IP address for the requested domain name (website you visit)).

By default, our computer cache DNS results in order to provide fast lookup in future- and that’s really good (because it’s efficient and saves a lot of resources), but some times it creates a problem specially when a domain gets new IP address(s) (or in other words, the server is changed). In such case the cached result may prevent you from viewing the latest website/app for your domain. So that’s where – flushing the DNS cache results, is mandatory.

There are various ways to clear dns cache in Ubuntu  but using nscd (name service cache daemon) is very simple and straightforward (and it works with almost all – commonly used GNU/Linux distributions such as Fedora, Mint, OpenSuse etc).

Install NSCD Daemon in Ubuntu 12.04 LTS

open a terminal and execute –

sudo apt-get install nscd

Clear DNS Cache from terminal

nscd-restart

sudo /etc/init.d/nscd restart

That’s All. If you want to know more about the features of nscd then run the command with -help flag –

nscd -help