Block Websites in Ubuntu Linux

by MJK on January 2, 2010

If you are using a Ubuntu Linux operating system and your computer is frequently used to connect to internet, you might want to block some sites from being visited using your computer. So here is a simple method for it.

How to Block Unwanted Website in Ubuntu Linux?

The process to block websites in Ubuntu Linux is very simple and doesn’t require any third party application. You just need to make a simple entry in the /etc/hosts file. /etc/hosts is a very important file which handles DNS and internet handling on Linux based systems. In order to block some site from opening, open the /etc/hosts file by typing the following command on the terminal:

gedit /etc/hosts

and add the following line: domain.com

Example yahoo.com

Here replace domain.com with the name of the domain that you wish to block. Once the above exercise is done, who ever tries to access the site will get a message “Failed to Connect”.

Done! Do let us know if you have any alternative method for the above task. We will really like to add it to the post.

Related Articles:

  1. 40 Hotkeys in Ubuntu Linux
  2. Android Theme for Ubuntu Linux
  3. YouTube Client without Flash for MAC, LINUX and Ubuntu
  4. Dell Latitude 2100N – Ubuntu Linux Netbook Review & Specs
  5. Ubuntu Themes: 61 Awesome Themes for Linux
  6. mod_pagespeed – Google Tool to Make websites load faster

{ 4 comments… read them below or add one }

artoflinux January 2, 2010 at 11:44 pm

useful tips, than’s for sharing


Don Birdsall January 3, 2010 at 3:26 pm

Editing the ‘hosts’ file can be done on other platforms as well, even Windows. A few years ago, before browsers had extensions to block advertising, it was used to do that. In fact, ad blocking hosts files could be found and downloaded from the Internet.


Raymond Bastilla January 8, 2010 at 3:30 pm

Interessantes Thema. Ich bin aber nicht ganz eurer Meinung, aber das ist ja auch kein Forum hier. Bleib am Ball.


mikay July 22, 2010 at 3:08 am

thanks, ive tried the script, and it works well! thanks a lot…
my question is, how do i UNBLOCK? or undo the sites that i was able to block using the script?? thanks ^^


Leave a Comment

{ 2 trackbacks }

Previous post:

Next post:

payday loans payday loans online online payday loans online loans installment loans payday loan spot loan loans online cash loans payday advance online installment loans