If your Ubuntu computer is used by some one else besides yourself, specially children, then you might want to restrict some websites and make sure they do not open on your system. Here is a quick way to block such sites in Ubuntu. It is extremely simple 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:
and add the following line:
Here replace domain.com with the name of the domain that you wish to block.
Now whenever there is an attempt to open the blocked website, the web browser will display the “Failed To Connect” message.