Hacker News new | ask | show | jobs
by ramblerman 3160 days ago
- on linux/osx its /etc/hosts

- on windows its c:\Windows\System32\Drivers\etc\hosts

If you add a line in it like

     0.0.0.0 reddit.com www.reddit.com
You tell the computer to use 0.0.0.0 (your own address) for those domains, and they subsequently won't load.
3 comments

0.0.0.0 is the "any" address. Binding to it means you want to receive connections from all interfaces, sending datagrams to it means you want to broadcast to all hosts, and so on.
Note for Windows users: hosts file requires admin privileges to edit. So launch e.g. notepad as admin (launching as admin should be available if you right-click on the notepad icon), and go find the file. Also remember that you need to switch the dropdown to "All files (.)" in the Open File dialog.
Thank you very much for your reply. I magic barred it on my mac and couldn't find it. A little more help? Know the direct path? Is it global or per browser? Thanks again.
Those are the direct paths and it's system global.

BTW. 0.0.0.0 is not "your own IP", that would be 127.0.0.1. 0.0.0.0 is non-routable, so always resulting in error.

Strange. Neither sportlight or alfred can find it. (and alfred does search though system files)
The file name is just “hosts” and it’s located in a folder called “etc” - maybe that helps? I think there is also a macOS setting that hides certain system files. You may have to unhide it first.
Open terminal, type:

  cat /etc/hosts
if it outputs something that has to do with network, you know the file is there :). It might be that default user-facing tools on Mac don't look for system files?