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

Explanation:

sudo

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

nano

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

/etc/hosts

That is the path to the host file

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

127.0.0.1       localhost
127.0.1.1       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:

0.0.0.0   www.youtube.com
::0       www.youtube.com
0.0.0.0   www.nytimes.com
0.0.0.0   nytimes.com
::0       www.nytimes.com
::0       nytimes.com
0.0.0.0   www.cnn.com
0.0.0.0   cnn.com
::0       www.cnn.com
::0       cnn.com
0.0.0.0   www.abcnews.go.com
0.0.0.0   abcnews.go.com
::0       www.abcnews.go.com
::0       abcnews.go.com
0.0.0.0   www.washingtonpost.com
0.0.0.0   washingtonpost.com
::0       www.washingtonpost.com
::0       washingtonpost.com
0.0.0.0   twitter.com
::0       twitter.com
0.0.0.0   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
243 views