What is a computer host file and how to edit a host file?
Sometimes you will need to edit the host file on your computer. Through file hosts, you can control access to websites and network traffic.
The host file has been in use since ARPANET. They are used to resolve host names before DNS.
Microsoft keeps the hosts file in the Windows network, which is why it changes so little even if it is used in Windows, macOS or Linux.
The first part will be the location to redirect the address, the second part will be the address you want to redirect and the third part will be the comment. They can be separated by a space, but for readability are usually separated by one or two tabs.
Windows 8 or 8.1 and 10
If you use Windows 10, the way to edit the host file will look like this:
When you're done, open the following file using the File -> Open feature: c: windowssystem32driversetchosts
You can then edit as usual.
Windows 7
To access the hosts file in Windows 7, you can use the following command in Run to open notepad and file.
When notepad is open, you can edit the file. In this example, we will block Facebook. To do this, simply enter the following after the www.facebook # com
After editing the host file, save it.
Now if you try to access Facebook in IE it won't work. We also cannot access Facebook through Google Chrome.
macOS (Any Version)
In macOS, accessing the host file is also quite easy. Start in the terminal and use the editor.
The files will look a bit like Windows, though not as intuitive. Again we will block Facebook.
This time use 0.0.0.0 as a loopback and will direct you to the computer's Apache test page.
You should read it
- Simple and fast steps to edit Host File on Windows 10
- Facebook host file, How to edit the host file on facebook 2017
- How to create a new host file on Windows
- How to open the Host file on Windows 10, edit the hosts file
- How to edit the Host file, how to edit the Host file, read and open the Host file
- How to fix the hosts file on Windows 10
- How to host your own website on Raspberry Pi
- How to open the hosts file with Admin rights - Apply to open the file system
- Protect computer network with Bastion host (fortress server) in just 3 steps
- Fix Service Host Local System status using multiple CPUs in Windows 10
- Fix SysMain Service Host using a lot of CPU and memory in Windows 10
- 9 types of servers that can be hosted on Raspberry Pi