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
- 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
May be interested
- Winstall.app - web-based GUI for Windows Package Manager onlywinstall.app is a web application that acts as a gui version of windows package manager, helping users find and install applications more easily on an individual basis.
- How to prevent Epic Launcher from launching with Windowsto make windows 10 boot faster and reduce boot time, here are the steps you need to follow to remove epic from windows startup and prevent epic launcher from launching with windows 10.
- 3 ways to save files better on the desktopyou should not save files on the desktop. there are better ways to store computer files and keep the desktop tidy. the following article will show you where to save files more effectively on windows 10.
- How to save a list of running processes to a file in Windowssometimes, it seems that there are so many processes running on the computer that you're not sure if everything is okay. the first step you should take is to create a list of running processes and put them into a text file, so you can analyze which processes are running.
- Microsoft released Windows Terminal 1.0, announcing support for the GPU and Linux GUI application in WSLwindows terminal now has a preview for businesses, windows subsystem for linux (wsl) 2 is getting support for gpu, linux gui application and simplified installation experience.
- What is Igfxtray.exe?when you learn about the files that come with the system, you will certainly see the presence of the file 'igfxtray.exe' if you are using the intel cpu platform. but do you know what igfxtray.exe is and how it works?