- dotTech - https://dottech.org -

How to edit hosts file in Windows 7 and 10 [Tip]

winThere may be some instances when you want to edit your hosts file on your Windows machine. The main aim of editing your hosts file on Windows is to control access of your machine to particular websites and networking traffic.

The hosts file is used mainly to resolve issues related to host names. The hosts file can be a huge file that contains a lot of information. Be it any operating system, the syntax of the hosts file remains the same. In most cases, the hosts file has a lot of loopback entries. A common entry in a hosts file will look like this: 127.0.0.1 localhosts #loopback, where the first part represents the IP address to redirect to, the second part is the address to which you will want to re-direct and the third one is the comment. These entries are separated usually by a tab for easy reading.

Steps to Edit Your Hosts File on a Windows Operating System

In Windows 10 machine, running programs as Administrators can turn out to be a little bit annoying at times. For example, if you want to run Notepad as an Administrator, you need to go to the Search option to search for the application and then right click on it and select the option “Run as administrator.”

Now to edit your hosts file on your Windows 10 machine, the first step is to open Notepad by selecting the option “Run as Administrator.”

  1. Once you have opened notepad to run as administrator, you need to search for the hosts file. Usually, you can find the hosts file in the path “C:\Windows\system32\drivers\etc\hosts.” Open the file using the Open option in Notepad.
  2. Now you can easily make the necessary changes in the hosts file and save it. You have to ensure that the entries you made in the hosts file are correct and follow the format correctly.

If you are using a Windows 7 machine, then you should follow the steps given below to edit your hosts file for editing.

  1. Click on the Start button and select “Run” and then enter the value “Notepad c:\Windows\system32\drivers\etc\hosts”
  2. Next, press on the OK button to open the hosts file in Notepad.
  3. Now, make the necessary changes and save the file.

You can also edit your hosts file in other operating systems such as Ubuntu and MAC. To edit your hosts file in an Ubuntu operating system, you have to follow the steps given below.

  1. Open the GUI text editor and open hosts file from the computer.
  2. Now, make the necessary changes to your hosts file and save the file. In Ubuntu when you try to edit the hosts file, you can see that there is a section called IP6. You do not have to make any changes there.

If you are using a MAC operating system, you need to follow the steps given below to edit your hosts file.

  1. Open your favorite editor just like you did in Ubuntu.
  2. Open the hosts file from the path that is similar to that in a Windows operating system.
  3. Make the necessary changes to the hosts file and then save the file.

Conclusion

Making changes to your hosts file on the Windows operating system is not a difficult process. But you should be careful not to mess-up the format when you edit your hosts file.