hanki.dev

block websites with hosts

I used to use LeechBlockNG to block websites which I found myself spending a little too much time on. Great extension, but I found it too easy to just open another browser to enter the site I was craving.

My current method of blocking specific sites is to just redirect them to 0.0.0.0 by modifying hosts. Simple and requires no additional programs or extensions. Obviously as easy to revert as it is to apply, but has worked for me so far.

# /etc/hosts
0.0.0.0 reddit.com
0.0.0.0 old.reddit.com
0.0.0.0 www.reddit.com
0.0.0.0 news.ycombinator.com

Note that after modifying hosts it might take a moment for the DNS cache to expire.


✌🏼 Like my content? Subscribe via RSS feed.