What is a Hosts File?
The hosts file is a plain text file in most operating systems that maps hostname to IP addresses. In simple terms, it is a telephone book as it is used to associate host names with IP addresses.
In plain terms, the local hosts file is much like a DNS (Domain Name System) as it is a telephone book of websites. The only difference is its priority. When you type in a website, the computer checks the hosts file first to see if there is a listing for that website in the host file; if not, it will check with your selected DNS server for the listing.
Most operating system as well as mobile operating system has a host file. In Microsoft Windows 3.1 it is %WinDir%\HOSTS, in Windows 9x operating systems, it is %WinDir%\hosts, and the rest of the Windows operating system is located %SystemRoot%\system32\drivers\etc\hosts. In early editions to Apple’s Mac OSX, a listing is added through the NetInfo or niload, and from Mac OSX 10.2 and higher, it is located in /etc/hosts. Similarly, Google’s Android and Apple’s iOS hosts file is also located in /etc/hosts.
There are some benefits of editing the hosts file. One reason to edit the host file is to make sure that a that machines without actually bringing the machine to a network to test. Another reason is to “possibly” increase browsing speeds, though it is known to slow down if there is a lot of entries in the host file. One other reason to edit the hosts file is to block access of certain programs, like adware / spyware or programs that are filled with ads.Though the host file allows you to control what IP to connect to, it can also be used by malicious program to route you to malicious sites that can take your personal information and / or install even more malicious code into your system.