How to block Ads (Linux)

blocked Ad

Well, I’ve just knew how to block ads (in Linux, BSD, and SolarisUnixes), so I’m going to share this with  in this short 4 steps tutorial! But before I start, for those who might ask “why would I want to block ads?” “Why should I?” for two things: to have your page loaded quickly and to not be annoyed ever again (… not really, I’ll tell the reason later on)!

Step1. Open nautilus as root.

step2. Change the directory to “/etc/”  and open the text file “hosts”.

What you are going to do  is that you’re going to insert URLs of ads in the text file and going to redirect that URL to localhost IP(; so that when the ad wants to load it’ll search in your IP(localhost), but it is not on your PC so it’ll go like “Not Found” which also means blocking ads(you could block unwanted sites too). The good thing is that you don’t have to enter every single ad URL; cause there are some sites which helped us with this; they provided a very long list containing all those URLs(ads)! just like anyhow let’s continue…

Step3. Copy the list from this page and paste it in “hosts” text file.

Step4. Save the document.

Congratulations, That’s it, you’ve just blocked all the URLs that are in that list. … About what I said before a while ” to not be annoyed ever again (… not really)” the reason is that there might be some new ad sites which are not included so they will appear in your browser, but you can always add the URL to the text file 😉 … and to be honest since I’ve done that till now I haven’t seen a single ad (even’s… sorry pal), so enjoy and don’t worry.

One last thing, I’d like to thank SIGTERMer for some reason

Anxious Nut

6 thoughts on “How to block Ads (Linux)

  1. First of all I don’t like/believe in add-ons. 2nd of all, this add-on works only with FireFox, unlike this (what is written in the tutorial); this (blocking) works for all browsers!

  2. I know that putting fake host mappings in hosts file solves the problem for all OS applications, but it takes some effort and manual work and regular updating to maintain the list of offending ads.

    That’s doesn’t happen with AdBlock Plus. Heck, they even update the detection methodology should one ad company find a loop-hole!

    I don’t use a browser other than FF and I love the addons it has: AdBlock Plus, Privoxy and NoScript.

    btw, the same solution you proposed works on Windows, in case you didn’t know. The location of the hosts file is of course different.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.