3 ms·
This is a great idea. Mind sharing your script? I block annoying sites with my hostfile, too, but every once in while I actually need to look at something on Fa
by zecho 16y ago
This is a great idea. Mind sharing your script? I block annoying sites with my hostfile, too, but every once in while I actually need to look at something on Facebook. This would also be useful as it's a big mess with all the changes I have to make for work, too. Storing them separately would be super helpful.
- xuki 16y agoCreate 2 files hosts.work & hosts.play in /etc Add these 2 lines into .profile or .bash_profile alias work='sudo cp -f /etc/hosts.work /etc/hosts' alias play='sudo cp -f /etc/hosts.play /etc/hosts' If you don't want to sudo, chmod /etc/hosts.
- yogsototh 16y agoGreat idea! Should be mixed with crontab that disable "play mode" every 30 minutes forcing you to manually copy the play host file.
- loire280 16y agoJust remember to be careful with changing permissions on your hosts file. You wouldn't want an unprivileged user to be adding lines to it. 69.57.123.17 your-bank.com
- rhizome 16y agoalias work='sudo ln -sf /etc/hosts.work /etc/hosts' alias play='sudo ln -sf /etc/hosts.play /etc/hosts'
- aquadoctorbob 16y agoHere's how I do it, improvements welcome: https://gist.github.com/875467 https://gist.github.com/875467
- zecho 16y agoAwesome. I actually started to write a script based on cp'ing different hostfiles, but I think I like this way better. Thanks!