What is a computer host file and how to edit a host file?

- File host is a file that stores important IP information on the computer and helps the operating system recognize the IP of the server where the specific domain name is managed.

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

Picture 1 of What is a computer host file and how to edit a host file?

If you use Windows 10, the way to edit the host file will look like this:

Picture 2 of What is a computer host file and how to edit a host file?

When you're done, open the following file using the File -> Open feature: c: windowssystem32driversetchosts

Picture 3 of What is a computer host file and how to edit a host file?

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.

Picture 4 of What is a computer host file and how to edit a host 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

Picture 5 of What is a computer host file and how to edit a host file?

After editing the host file, save it.

Picture 6 of What is a computer host file and how to edit a host file?

Now if you try to access Facebook in IE it won't work. We also cannot access Facebook through Google Chrome.

Picture 7 of What is a computer host file and how to edit a host file?

macOS (Any Version)

In macOS, accessing the host file is also quite easy. Start in the terminal and use the editor.

Picture 8 of What is a computer host file and how to edit a host file?

The files will look a bit like Windows, though not as intuitive. Again we will block Facebook.

Picture 9 of What is a computer host file and how to edit a host file?

This time use 0.0.0.0 as a loopback and will direct you to the computer's Apache test page.

Update 25 May 2020
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile