Photo: thetimepiece.wordpress.com

This is a simple step by editing a host file. Although many of them know this trick yet its not popular among public. Lets come to the main part, you can ask me how do one block a website without any software.

How to Open Host File in Windows

The mappings of IP address is contained in Host file. Generally Host file is located in %SystemRoot%system32driversetchosts in windows xp where %Systemroot% is the default root directy that will usually be c: etc. To know more about host file and its location visit Wikepedia. You can open host file using notepad or any other text editors.

How to Open Host File in Mac

  • Launch Terminal , found in /Applications/Utilities/ or launched through Spotlight
  • Type the following command at the prompt: sudo nano /private/etc/hosts
  • Enter the administrator password when requested, you will not see it typed on screen as usual with the command line
  • Once the hosts file is loaded within nano, use the arrow keys to navigate to the bottom of the hosts file to make your modifications
  • When finished, hit Control+O followed by ENTER/RETURN to save changes to /private/etc/hosts, then hit Control+X to exit out of nano
  • Quit out of Terminal when finished

Screenshot:

How to Block Websites and Ads

You can use a host file not only to block website but also to block unwanted ads, banners,etc. Generally a host file contains like this

127.0.0.1 localhost

To block a site just enter the webaddress name after the localserver in the host file, see example below:

127.0.0.1 localhost
127.0.0.1 badwebsite1.com
127.0.0.1 badwebsite2.com

If you want to block Google Adsense, It will be like this:

127.0.0.1 pagead.googlesyndication.com
127.0.0.1 pagead2.googlesyndication.com

Make sure you type the above code without living any line after localhost. Before editing the host file make a backup of it.