A must have hosts file

My friend Dan Pollock has been compiling the must have hosts file for some time. According to Wikipedia, the hosts file is a computer file used in an operating system to map hostnames to IP addresses. The hosts file is a plain-text file and is traditionally named hosts. What Dan’s host file does it list all of the known hostnames that are undesirable, and redirect them to localhost (back to your computer instead of to their website). This makes your web surfing faster, more private and more secure. Check out Dan’s list. I recommend you replace your host file with Dan’s, there are instructions on how to do this on his website.

 

On MacOSX:

  • Open Terminal (Under Utilities). Type this:
  • sudo cp /etc/hosts /etc/hosts.backup
  • # this backs up your current /etc/hosts in case something goes wrong, you can “sudo cp /etc/hosts.backup /etc/hosts”Enter your password, and you should be back at the prompt when this is complete
  • Copy and paste this entire file  to your Desktop as a file called “hosts” in TextEdit in UTF-8 after choosing: Format: Make Plain text. (Uncheck the box checked that says if no extension provided leave as .txt)
  • Now go back to Terminal and type:
  • sudo cp ~/Desktop/hosts /etc/hosts
  • (If you’ve taken more than a few minutes between steps here, you’ll likely have to enter your password again here)
  • Now run the command in terminal:
  • grep Last /etc/hosts
  • If it shows a date, you’re all set (the date is which version of Dan’s file you’re using)! For example, as of writing this, mine says:
  •  # Last updated: Apr 17th, 2012 at 01:44
  • If at any time you want to backup to your old file in Terminal:
  • sudo /etc/hosts.backup /etc/hosts