hosts file

    • 221 posts
    October 22, 2024 12:05 AM PDT

    I do not run a public web page for which I encourage traffic so hope I am not pointing out the blatantly obvious to you Web Admins but I'd like to mention the 'hosts' file on every local computer which can be very handy.

    Many people know that a browser does not understand techsrealm.com - a browser needs an IPv4 or IPv6 address and that is where Name Servers come in.  Magically behind the scenes and transparent to us users the domain name techsrealm.com is translated into an IP address and then the web page appears.

    The hosts file is  located as follows;

    • Linux /etc/hosts
    • Windows C:\Windows\system32\drivers\etc\hosts
    • Mac - not sure but a web search would find it.


    This is an ordinary text file where you can set an alias to any IP address
    eg   tr   <numbered IP address>

    Now if you enter tr in the browser it goes straight to the techsrealm.com site

    Some nerds use this file to block sites, for example, the following entry would block facebook

    127.0.0.1     www.facebook.com

    As 127.0.0.1 is the local machine address directing www.facebook.com to that address effectively dumps it.

    With most computer setups the default order is to check the hosts file before Name Servers so can be much quicker too for regularly used domains, but of course, you have to know the actual IP address.

    This of course only works on the computer where the hosts file is edited, does not affect other computers on the home network. May need a reboot for changes to take place plus I think windows configuration has the hosts file as the first search option.

    Geffers