Skip to main content


Showing posts from April, 2011

Tip and Trick for activities around DNS on windows.

Disabling DNS caching in windows. 
         To disable dns caching momentarily (until your windows is restarted), run below command in command prompt as : net stop dnscache sc servername stop dnscache
To disable the dns caching permanently on your windows , we have to use Services tool to disable the DNS Client service. DNS client service can be disabled by following below steps.
Click on Start on your desktop and click on Run. Type Services.msc in the Run command box. A services window will pop up. Look for a service called DNS Client. Double click on the listed DNS Client service and click Stop.

How to flush DNS cache in Mac, Linux and Windows

We sometime require to flush the system's DNS cache to resolve  issues raised around dns. The following section provides you the information about how to do it on Mac, Linux or Windows
Flushing DNS cache on Mac OS X. Launch Terminal application and run the command ( On Leopard,Snow Leopard and Above)            $ dscacheutil -flushcache Or if your operating system is Tiger, then            $ lookupd -flushcache

Flushing DNS Cache in Linux.
 In Linux, the "nscd" daemon/service is responsible for managing the dns related operations. To flush the dns cache on linux , simply restart the "nscd"  service with command " /etc/init.d/nscd restart " in terminal with root privileges.Flushing DNS Cache in windows.
On windows , to flush the dns cache - open command prompt and run the below command. C:>ipconfig /flushdns

How to grep for few lines before or after search string with grep command

The grep command in linux/unix allows you find the keyword you are searching, instead of return a particular line that contains the keyword, it allows you to specify how many lines to return by specifying -A  or -B option as below
$ ifconfig | grep -i eth0 -A 5  
Will give you 5 lines after the keyword eth0 was hit in the process of search.

$ ifconfig | grep -i eth1 -B 2  
Will give you 2 lines before the keyword eth1 was hit in the process of search.