Sitemap

The 1-line Productivity Hack

3 min readAug 16, 2013

I always try to keep things simple, and this is about as simple as it gets. This is a 1-line productivity hack. Minimal effort, maximal effect.

I’ve found that when I need to focus, the best thing for me to do is put on a pair blinders. In our digital age, especially while doing digital work, that means voluntarily blocking your favorite time-sink link-trap websites. Good news: It’s very easy to do.

But real quick before we get to it, a disclaimer: You’ll be editing your Hosts file (on disk: /etc/hosts), which controls how IP addresses are mapped to URLs. It’s a damn important file. If you’re worried about mucking it up, this isn’t the hack for you. Nothing here is irrevocable; it won’t break your computer. But you should still be safe. You should backup this file before you mess with it. Also, these instructions pertain to OSX/Unix but the process on Windows should be similar.

Alright! Let’s do it.

Step 1: Copy this command:

echo ‘127.0.0.1 huffingtonpost.com www.huffingtonpost.com reddit.com www.reddit.com cnn.com www.cnn.com news.ycombinator.com’ | sudo tee -a /etc/hosts

Step 2: Open Terminal.

Step 3: Paste the above line, and sub in your time-sink websites. Make sure to double-up with “www.” — lots of browsers will automatically add “www.” if a naked domain doesn’t respond.

Step 4: Hit “Enter”. Type your password to confirm the edit to your file.

Step 4: GTD / JFDI / PROFIT

What this does is map your favorite websites to show content from the IP address “127.0.0.1" — otherwise known as “your computer”. To be totally clear: when you go to these URLs, nothing will show up.

By a very unscientific measure, I reclaim about an hour a day by keeping myself from idly loading up Hacker News or HuffPo. I’d typically check the front page of either to fill some empty time between calls, while my code is compiling, etc.. The time spent adds up, very quickly.

Get Aaron Grando’s stories in your inbox

Join Medium for free to get updates from this writer.

The first couple days are the hardest; content addiction is a lot like a lot of other addictions. If you’re like me, your muscle memory will have you typing these URLs into your browser’s address bar without a thought, a couple dozen times, before you’re able to consciously stop yourself.

But then, after a while, you’ll get used to it. You’ll be better off for it.

The best part comes after a couple of weeks: you’ll realize you don’t need to visit these link-trap middlemen to get through your digital days. You’ll be more productive. You’ll find blogs and authors to follow and be closer to the content than you’ve been in years.

The 1-line Undo

There will come a time when you need to get back on to one of these sites. It’s just as easy to unblock these sites as it is to block them.

(If you frequently work in your Hosts file — you know who you are — you should probably not use the instructions below, to be safe. Thankfully, you’ll know what’s happening and you’ll know how to undo it without the instructions below.)

Undo Step 1: Copy this command:

sudo sed ‘s/^/#/g’ -i /etc/hosts

Undo Step 2: Open Terminal.

Undo Step 3: Paste the above line.

Undo Step 4: Hit “Enter”. Type your password to confirm the edit to your file.

Undo Step 5: You’re Un-blocked. Resubmerge yourself. Take a moment, revel in it. Hold your breath, get what you’ve got to get done, done, and then re-enable your block. You don’t need these websites.

The command above simply “comments out” the last line of your Hosts file. Which, if you didn’t edit the Hosts file in the mean time, will unblock the sites you entered.

I hope this helps you find some focus. Get out there and get it done!

This post also appears on my website, where I keep my writing more current and am allowed more freedom and control over the content. Thanks for reading!

Aaron Grando
Aaron Grando

Written by Aaron Grando

Tech Lead @RedTettemer. Asskicker. Everyone ♥er.