A simple website blocker
I have been visiting some websites out of habit that don’t make me feel great, so I started looking for website blocker apps. In the process of doing so, an easier solution came to mind - editing the /etc/hosts file.
I opened /etc/hosts, and set the IP address for the domain I want to block (LinkedIn in this case) to 0.0.0.0. The address isn’t a valid destination address, so the browser fails to connect after the domain is resolved.
0.0.0.0 www.linkedin.com linkedin.com
I can append other domains to the above line after the IP address, or add another line with the same address and another domain if this line starts to get too long.
I flushed the DNS cache on my machine and after a while, LinkedIn doesn’t load anymore! Mission accomplished!