All addresses in the file are formatted with an IP address followed by whatever pointer indicates the original resource. Anything that attempts to access said resource would first check the hosts file to see where it should get redirected before loading it. Since doing this involves editing a critical system file, its best to first make a backup of  before editing it in case anything were to go wrong.

Presume that nastysite.bad, which does not exist in reality, represents a nasty Website that you wish to block out. At the Linux CLI prompt, type either sudo nano  or sudo vi  to edit the hosts file from a text interface, or perhaps gksu gedit  to edit it graphically. You could also use another graphical editor like mousepad or leafpad to do so, but make sure to use gksu when requiring root access with a piece of graphical software. Enter your administrator password to continue. You can then add two lines to block nastysite.bad out of your system: 0.0.0.0 nastysite.bad :: nastysite.bad The first blocks it from legacy IPv4 access and the second blocks it from modern IPv6 access. Make sure the file doesn’t read [Readonly] or something else at the bottom or in the title bar before saving, otherwise your work won’t actually be saved.

System administrators tend to debate where the correct area to add the block lines in a hosts file is. You will more than likely have a line stating the following:

The following lines are desirable for IPv6 capable hosts

Some administrators would encourage you to add any user-created lines above this comment. Others insist that user-created lines should only be added after whatever line is last in the generated  file. Regardless of where you’d like to add them, make sure to add a line above them that’s been commented out so you know what you’ve blocked. For instance, if you were trying to block the example line above, then script the file as such:

Added Block Line on 12/10

0.0.0.0 nastysite.bad :: nastysite.bad Edits to the hosts file may take place immediately or after a restart. It depends on your local configuration. Once again please be sure to make a backup copy of , so if you were to make any mistake you can simply overwrite your errant file with this original and thus avoid any Internet connectivity problems.

Fix: The Device DeviceHarddisk0DR0 Has a Bad BlockNintendo sues two major ROM sitesFirefox Monitor: Mozilla Firefox’s New Safety Feature Will Show You…How to Permanently Enable Desktop Sites in Chrome for Android How to Block Bad Sites with  etc hosts  - 95How to Block Bad Sites with  etc hosts  - 3How to Block Bad Sites with  etc hosts  - 63How to Block Bad Sites with  etc hosts  - 65How to Block Bad Sites with  etc hosts  - 11How to Block Bad Sites with  etc hosts  - 74How to Block Bad Sites with  etc hosts  - 84How to Block Bad Sites with  etc hosts  - 1