Increase your productivity every day by following this 1 weird old tip.

$ sudo vim /etc/hosts

127.0.0.1       reddit.com
127.0.0.1       www.reddit.com
127.0.0.1       news.ycombinator.com
127.0.0.1       facebook.com
127.0.0.1       www.facebook.com
127.0.0.1       twitter.com
127.0.0.1       www.twitter.com

:wq!

Until next time!

Comments

September 09, 2015, 07:45

What does it do?
Will it block the above link or redirect them to localhost?

Samujjal Permalink
September 09, 2015, 15:29

Redirect requests to all the sites listed to you localhost domain.

lava Permalink
September 09, 2015, 08:30

Since when hosts changed format?
IP host hostalias...

September 09, 2015, 15:09

Oh whoops. I thought something didn't look right. Fixed. :)

Deibit Permalink
September 09, 2015, 08:32

There are two problems with this approach. First, you have to check you are not running a http proxy in 127.0.0.1. Second problem is a reflexive identity problem. It is easy to understand. If your are one of the sysadmins of these sites and your are working in the main server...it won't work for you. Tip: you can save a character in vim: just write :wq without the !

B. K. Oxley Permalink
September 09, 2015, 10:12

Try using 0 (zero) for the address. It may skip the loopback and it's self-documenting your intent.

September 10, 2015, 16:01

he he, poor developer where do he go now :)

September 11, 2015, 17:32

Another productivity hack, use :x instead of :wq :)

Leave a new comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the word "unix_479": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.

Advertisements