Tired of being distracted all the time. When you are connected to the internet, the temptation to visit movie streaming sites, YouTube, Twitter, Facebook, etc… is excruciating. You cannot get any work done. There is a way to block those sites without using outside tools.

In the terminal enter this:

sudo nano /etc/hosts



is superuser. It superceeds the security function in Linux/Unix and you will have permission to unlock system files.


That is the basic text editor that comes bundled with Linux/MacOSX systems


That is the path to the host file

After pressing enter you will see this in your host file.       localhost       black

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

After those parameters, you can enter the offending websites like this:   www.youtube.com
::0       www.youtube.com   www.nytimes.com   nytimes.com
::0       www.nytimes.com
::0       nytimes.com   www.cnn.com   cnn.com
::0       www.cnn.com
::0       cnn.com   www.abcnews.go.com   abcnews.go.com
::0       www.abcnews.go.com
::0       abcnews.go.com   www.washingtonpost.com   washingtonpost.com
::0       www.washingtonpost.com
::0       washingtonpost.com   twitter.com
::0       twitter.com   www.linkedin.com
::0       www.linkedin.com

To be safe enter ipv4 and ipv6 versions of the ip addresses to get full blockage.

What is ipv4 and ipv6? According to Wikipedia >>

ipv4 ==

Internet Protocol version 4 (IPv4) is the fourth version of the Internet Protocol (IP). It is one of the core protocols of standards-based internetworking methods in the Internet, and was the first version deployed for production in the ARPANET in 1983.

ipv6 ==

An Internet Protocol Version 6 address (IPv6 address) is a numerical label that is used to identify a network interface of a computer or other network node participating in an IPv6 computer network. In contrast to IPv4, which defined an IP address as a 32-bit value, IPv6 addresses have a size of 128 bits. Therefore, IPv6 has a vastly enlarged address space compared to IPv4.

If you want to go deeper, please read further more. I encourage it!

Ctrl + O

to save, then

Ctrl + X

to exit the nano text editor. After a full refresh, Voila! Your offending websites zapped!

Block websites the hard way

Category: NotesProgrammierung