Note: this is very much a beginner's guide.

Q: What is a HOSTS file / Why might I want to do this?
A: It's explained nicely at

Q: But why do this in Ubuntu? My Ubuntu is like a shield of steel!
A: Many reasons. But mainly to save bandwidth by not loading lots of rubbish. For each site listed as, content (usually ad banners etc) from that site isn't loaded. In a web browser that picture/frame will 404.

So, how to do it:
The host file in Linux lives at /etc/hosts. We are going to add some lines to it.


***** NOW HEAR THIS *****

A) ***BACK UP*** your /etc/hosts BEFORE YOU START

B) You must APPEND to (not overwrite) the file. You need the stuff that's already in there! That means: paste in the additional lines AFTER what's already in there!

C) I do not recommend doing this if you HOST WEB PAGES from your PC.

End of disclaimer.

1) >>>>>>> BACKUP YOUR HOSTS FILE <<<<<<<<<

$ sudo cp /etc/hosts /etc/hosts.old

2) Download a good hosts file. I recommend the MVPs one:

3) Open your hosts file.

$ sudo gedit /etc/hosts

4) Paste in the contents of hosts.txt into the bottom of /etc/hosts.

5) It should take effect immediately. Close and reload your web browser then try to go to one of the blocked sites. It should 404.