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:


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.

After those parameters, you can enter the offending websites like this:

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!

to save, then

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

Block websites the hard way

Category: Computer ProgrammingNotes