Protecting your computer’s wire tentacles from getting tangled up with the Internet’s less savory sites can be as simple as pasting a few lines of code into a file.
Want to stop your teenage son or daughter downloading games to your computer? Want to stop your husband from watching porn? (we all know the computer forced him to watch it, right?) Or do you want to block all the ads that slow down your Internet browsing?
All the above is easily done. You can even kill access to online casinos. In fact, you can block access to any site, even Google, Bing or Facebook, if you want to.
All you need to know are the domain names of any sites you want to block and the location of the “hosts” file that your computer checks to determine the IP address of any domain name it is asked to visit to block it from checking the remote DNS (Domain Name System) for the registered IP address for that domain.
This method of site blocking works with Windows, Linux, Unix, Posix, Android, Symbian, Mac OSx, iOS and most other operating systems (OS’s). It doesn’t matter whether your OS is installed on a desktop, laptop, netbook, mobile phone, smartphone or other handheld device. You can speed up your browsing, block access to websites and block ads so long as you can locate and edit the computer’s “hosts” file.
The instructions shown here assume you use either Linux or windows. If you use a different OS, consult the Table of Hosts File Locations at the bottom of this page to check the location of your operating system’s hosts file.
Read more here