Block a site on all browsers in Linux


Read {count} times since 2020

This tutorial will help you to block a site in all browsers on Linux

Open Terminal (ALT+F2).

Type sudo -i in the input field as shown in the picture above.
Check the Run in terminal option.
Finally click Run button.
Type your password if necessary and press enter.
Then enter the following commands.

gedit /etc/hosts

You will get Gedit Text Editor window.
For Example we need to block Facebook add the following lines just after 127.0.0.1 localhost

0.0.0.1         facebook.com
0.0.0.1         www.facebook.com

 That’s it. When you now open www.facebook.com or facebook.com You cannot access it. In Google Chrome you will get this page.

To enable back Facebook remove the lines we added from the file /etc/hosts.

0.0.0.1         facebook.com
0.0.0.1         www.facebook.com