How to block unwanted sites on linux?

In this post I'm going to show you a trick to block unwanted sites on your linux system. For this method we don't need any third party tool.
To block a site names "" follow these instruction:

Open the file /etc/host in any editor with root privileges. For that fire following command in terminal for debian based system like ubuntu:

sudo gedit /etc/host 

This will open /etc/host file in gedit.

At the end of this file add a new line entry like below:

(Note: here replace with the domain name of the site which you want to block.)

And done .... now try to open that site on your browser and your browser will tell you "I'm unable to connect..." :D .

Make sure you are testing with exact domain name means if you have added entry of then it will not block . You have to add separate entry for

You may also like

Popular Posts