The hosts file is a computer file used by an operating system to map hostnames to IP addresses. It is a plain text file, and is conventionally named hosts. In modern operating systems, the hosts file remains an alternative name resolution mechanism, configurable often as part of facilities such as the Name Service Switch as either the primary method or as a fallback method
To make things simple to understand, we can call Hosts file is like an address book. When one types an address like www.yahoo.com into your browser, the Hosts file is consulted to see if IP address for that site is available. If available, then site will open. If not, computer will ask your ISP’s (internet service provider) for the IP address of site. Most of the time client computer asks for the IP address from your ISP to find sites.
HOSTS file is located in the following locations for the listed operating systems –
Benefits of the Hosts File:
(1.) Uses less resources:
By using a function built into your computer, you will be able to block advertising sites. This will cut down on memory and processor usage, which will free up your resources for other tasks.
(2.) Works on connections other than HTTP:
Most ad-blocking programs will only intercept IP calls going to the HTTP (or web) port on your computer. Other transfers can still get through. The Hosts file, however, will block IP calls on any port, whether it is HTTP, FTP, or whatever else you happen to be doing.
(3.) Eliminate many tracking and privacy concerns:
By intercepting the IP calls before they ever leave your computer, the Hosts file can prevent advertising and tracking companies from ever even knowing you are viewing a web page. This will keep them from profiling you and help you keep your privacy. All sites in the Hosts file entered with a 127.0.0.1 address will never be accessed. Sites that are not in the Hosts file may still track you and send you ads.
(4.) The Hosts file is configurable:
Rather than relying on others to decide what sites to block for you, you may edit the Hosts file entirely on your own. This means you can put any site you wish into the Hosts file and that site will not be able to be accessed. You can use this to block advertisers, trackers, or sites you would not want your small children to see.
(5.) Increased browsing speed:
By placing sites into your Hosts file with their correct addresses, your computer does not need to ask another computer where to find a site. This can significantly speed up your surfing experience because your computer will go straight to that site instead of having to ask directions. Also, by keeping ads from being loaded using the blocking technique in the Hosts file, web pages will be viewable much more quickly since they won’t have to load a lot of fancy graphics.