Unfortunately, Windows 8 or 10 makes it annoying to open apps as administrator — but it’s not too difficult. Just search for Notepad, then right-click on Notepad in the search results list, and choose to run it as administrator. If you’re using Windows 10 this will be on the Start Menu.

If you’re using Windows 10, it’ll look more like this:

Once you’ve done so, open the following file using the File -> Open feature.
c:\windows\system32\drivers\etc\hosts

Then you can edit as normal.
Windows 7
To access the hosts file in Windows 7 you can use the following command in the Run Line to open notepad and the file.
notepad c:\windows\system32\drivers\etc\hosts

Once notepad is open you can edit the file. In this
0.0.0.0 www.facebook.com

Now that you have edited your Hosts file make sure to save it.

Now notice if we try to access Facebook in IE we can’t get to the page.

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 file.

Ubuntu
In Ubuntu 10.04 and most Linux

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

Now we can save the file 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.

macOS (Any Version)
In macOS, accessing the hosts file 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 file 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
