Académique Documents
Professionnel Documents
Culture Documents
1 of 6
http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-yo...
Now lets look at accessing the hosts les in the dierent operating systems
Windows 8 or 8.1 or 10
Unfortunately Windows 8 or 10 makes it annoying to open apps as administrator but its not too dicult. Just search for
Notepad, then right-click on Notepad in the search results list, and choose to run it as administrator. If youre using
Windows 10 this will be on the Start Menu.
Once youve done so, open up the following le using the File -> Open feature.
4/12/2016 3:45 PM
2 of 6
http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-yo...
c:\windows\system32\drivers\etc\hosts
Windows 7
To access the hosts le in Windows 7 you can use the following command in the Run Line to open notepad and the le.
notepad c:\windows\system32\drivers\etc\hosts
Once notepad is open you can edit the le. In this example we will block Facebook. To do this just enter in the following
after the # mark.
0.0.0.0
www.facebook.com
Now that you have edited your Hosts le make sure to save it.
4/12/2016 3:45 PM
3 of 6
http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-yo...
We also were not able to get to it in Google Chrome (check notes at the end). Also for more info on editing your Hosts le,
check out The Geeks article on how to create a shortcut to quickly edit your Hosts le.
Ubuntu
In Ubuntu 10.04 and most Linux distros you can edit the hosts le directly in the terminal. You can use your favorite editor
or even open your favorite GUI text editor. For this example we will use VIM. Like Windows 7, Ubuntus hosts le is located
in the /etc/ folder, though here it is in the root of the drive. In order to edit the le you will need to open it as root which is
why we use sudo here.
4/12/2016 3:45 PM
4 of 6
http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-yo...
Now that it is open we can edit it to redirect Facebook into nothing. You will notice that with Ubuntu there is also a section
for IP6. For most needs you will only need to edit it the top section and ignore the IP6.
Now we can save the le and try to go to Facebook.com. Just like in windows we will see that we are now redirected to a site
that does not exist.
4/12/2016 3:45 PM
5 of 6
http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-yo...
In OS X, accessing the hosts le is very similar to Ubuntu. Begin in terminal and use your favorite editor, even is you wish to
call a GUI text editor, it is easier to do so from terminal.
The le will look a bit more like Windows, only with a little less explanation. Again we are going to redirect Facebook.
This time it seems that 0.0.0.0 is a loopback and will direct you to the computers Apache test page.
Notes
There are some things to note from this walkthrough that we did notice. When tested it, Chrome did not use the hosts le
in any operating system but we were able to block Facebook in Chrome by adding www.facebook.com. Also, make sure to
place and extra line after the last entry for the section.
This should get you started in understanding the Hosts le and how it can help protect your computer. You can use it to
block sites that you dont want a PC to be able to access. If you have more suggestions for any of the operating systems we
coved, then leave a comment and let us know!
Create a Shortcut to Quickly Edit Your Hosts File in Windows
4/12/2016 3:45 PM
6 of 6
Chris is a Mac geek who still knows his way around Linux and Windows. He's
always looking for a good way to translate geek to english.
http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-yo...
Published 02/1/15
4/12/2016 3:45 PM