How to Block the Access to Certain Websites on Linux

By:Arjun Gautam

We can block the access to certain websites on linux as shown in picture below , facebook.com is refused to connect while youtube.com is opening in other tab.

Step : 1

Open /etc/hosts in text editor (gedit in my case) with sudo privilege as show in below diagram .

Step 2 :

You will get the text editor like this :

Step 3 :

Now add websites you want to block using

127.0.0.1 www.facebook.com

127.0.0.1 www.p*rnhub.com and so on .

Step 4 :

Subscribe to my youtube channel for more programming related videos.

www.youtube.com/arjuncodes

--

--

--

Learn Code with Fun.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Installing Python in Docker Container in RHEL8(Red Hat Enterprise Linux)

Kubernetes Secrets

Successful start! Let the green EGLD staking begin!

How AMA School of Medicine leads to SQL Injection by Neil Harvey Miñano

User experience on Enterprise application — Part 2

Spotify User Profile Analysis With Sportifyr — RStudio

Adding files to a raspbian SD card image with simple bash script

MySQL and WHERE. LIKE condition VS equal (=)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Code With Arjun

Code With Arjun

Learn Code with Fun.

More from Medium

Network basics related to wifi hosting (1/2)

[Solved] The requested image’s platform (linux/arm64/v8) does not match the detected host platform…

How to catch connection to malignant host at Ubuntu machine

Installing HashCat on Linux w/ Nvidia RTX dedicated Driver