How to block webpages and domain using the hosts file

You can use your computers hosts file to block any data being sent to or from your computer, for any domain. This is done by the operating system, and will block data on any browser of other program.

=Location of hosts file=

=Unix/Linux/BSD=
 * /etc/hosts

=Windows=


 * Windows 95/98/Me
 * c:\windows\hosts


 * Windows NT/2000/XP Pro
 * c:\winnt\system32\drivers\etc\hosts


 * Windows XP Home
 * c:\windows\system32\drivers\etc\hosts

=Editing the file= You shouldn't need to remove anything from the file so if you don't know what you are doing don't remove or change any of the line. Simply add the new lines below.


 * Make sure 127.0.0.1 localhost is the first line on the file.
 * Its OK to have blankg lines of commented lines before it. Comments are indicated by a '#'
 * Your localhost line maybe more complex, and that's OK, as long as it has 127.0.0.1 and localhost on the same line
 * Example: 127.0.0.1 PDP-8.homeland PDP-8 localhost


 * You can add any domains you wish to filter by adding a line in the following format. You can add as many lines as you wish
 * 127.0.0.1 domain
 * Example: 127.0.0.1 ads.spyware.com

=Example hosts file= 127.0.0.1 PDP-8.homeland PDP-8 localhost
 * 1) Local

127.0.0.1 www.google-analytics.com
 * 1) My filters

=See Also=


 * Guide to internet privacy

=References=
 * http://www.accs-net.com/hosts/how_to_use_hosts.html (Windows)

From HowTo Wiki, a Wikia wiki.