Wibbly Stuff

How to Block Websites in Ubuntu

You might need to block websites for many reasons. For example you don't want your employees waste time on social networking sites or want to block porn websites from your children. It is fairly easy to block websites in Ubuntu. We have done this in Ubuntu 10.04 Lucid Lynx and it might change in other versions.

You can block a website by editing the hosts file and pointing the domain to a IP that does not exist. We will point them to 0.0.0.0
For example, if we want to block facebook.com, first type the following in Terminal,
sudo gedit /etc/hosts
Now the hosts file will open.
Then add the following lines at the end.
0.0.0.0 facebook.com
Now save the file and you will be unable to access facebook via any browser.
If you know any other methods, feel free to share.