Sunday, March 25, 2012

How to block website in Windows/Linux (Ubuntu)

Windows



To access the hosts file in Windows you can use the following command in the Run Line to open notepad and the file.
notepad c:\windows\system32\drivers\etc\hosts



Add the line as shown in the below image. You may add one line for each website you'd like to block.  


That's it! - Very simple :) 




Linux (Ubuntu)
In Ubuntu and most Linux distributions - one can edit the hosts file directly in the terminal. Host file is in the root of the drive. In order to edit the file you will need to open it as root which is why we use sudo here. You can use any editor to edit this file.
Add the line as shown in the below image. You may add one line for each website you'd like to block.  

That's it! - Very simple :)