At least on an x86 machine (not 64-bit windows), the file is found here:
C:\System32\drivers\etc\hosts
Alternatively, you can enter this and find it:
%SYSTEMROOT%\System32\drivers\etc\hosts
The file has no extention, so you’re best off dragging it into a text editor. If you found this post by searching the web, you probably already know what the file does, and so your journey has ended here.
If you have no idea what this file does, I’d recommend you ask yourself why you’re reading random blog posts for the heck of it. .. And then you may proceed.
The hosts file is basically a set of aliases to IP addresses. For instance, you can type “localhost” into your browser, and you’ll hit your own computer. As far as this post goes, that’s pretty much the effect of tieing ‘127.0.0.1’ to ‘localhost’. (Let it be known that the two are slightly different, functionally, but it doesn’t matter for this discussion.)
So, tired of typing out any really long domain names? Access a remote computer’s web server frequently?
I have a linux box at home, which runs only a web server and a few tools of mine. Its name is ‘rydia’ (props to FF2/4), but my main desktop computer at home doesn’t know that. My computer at work doesn’t know that. So I figure out why my box’s IP address is, and then I alias it in my Windows hosts file:
5.122.120.173 rydia
You’ll note that the IP address is one given out by Hamachi. So then all I have to do now is put this into my browser:
http://rydia/
and I’ll get my little linux box’s web server.