If you’re anything like me, you find that compulsively browsing around the web eats up a lot of your time every day. It’s not time well spent, and you could have achieved more if you’d resisted the urge.
A simple trick I use to cut down on this is to edit the hosts file. The hosts file is a list of websites and the IP addresses your computer should use to connect to them. You can use this to block websites by giving an incorrect IP address: your own.
This way, each time your computer tries to connect to a website on the list, it just gets looped backed round and stops. The page won’t load. This is great for blocking particular domains that seem to take up a lot of your time.
It’s a very quick, simple way to avoid procrastination.
Finding the hosts file
The hosts file is in different places on different operating systems.
On Linux, it’s at:
These files need admin privileges to edit.
Open the hosts file with a simple text editor. Make sure that the first line reads:
and make sure that it stays that way! To block websites, you just add a line with the domain after 127.0.0.1, e.g:
It’s probably a good idea to add a comment above the section of blocked domains to make it clear what they’re doing there. In the end you’ll have something like this:
(Be warned, these sites will waste a lot of your time if you give them the chance!)
It usually takes a minute or two for the changes to actually take effect. This is what makes the method work. You can of course easily edit the hosts file again to unblock domains, but this little barrier should be enough to discourage you. And, in the minute it takes for the changes to happen, you can probably focus on your work again.
Also, I’d strongly recommend blocking dodgy domains with the hosts file.
If you found this useful, consider helping me out in return.