Editing your host file Print

  • 2

The "Hosts" file in an operating system is used to associate host names with IP addresses. A series of steps are used when searching for IP addresses that go with these host names. The first step, and the one that concerns us here, is the hosts file on your local computer. The Hosts file tells your computer what the name is in numbers so the computer can go find it. If the IP address is found in your Hosts file, the computer will stop looking and go to.

There are instances where you would need to edit your host file. If that need arises, you can follow the step-by-step procedure stated below:

For Windows:
1. Right click on Notepad or Notepad++ and select Run as administrator
2. Select File > Open > and browse to c:\windows\system32\drivers\etc\hosts
3. Once the 'hosts' file is open, you will see a commented description of the file in the first few lines and then below you will see an example on how to use it. The content of the file is actually divided into two columns. the "IP" column and the "domain" column.
3. Fill in the host file with the appropriate IP and domain information that you want to add.
4. Save the file.

For Mac:
1. Open "Terminal" Application under Application -> Utilities.
2. Once the terminal window is open, type "sudo vi /etc/hosts".
3. System will then ask you for your password, Input your password.
4. The file will then be opened by the "vi" editor. You will see a commented discription of the file in the first few lines and then below you will see an example on how to use it. The content of the file is actually divided into two columns, the "IP" column and the "domain" column.
5. To add another line, go to the last line and press "i" (insert).
6. Input the appropriate IP and Domain you wish to add.
7. When finished, press "Esc" key once.
8. On the bottom left part of the terminal console you will see a ":" (colon).
9. Type "wq", (write and quit) then press the "Enter" key.
10. Once back to the prompt, type "exit".

For Linux/Unix:
1. Open the "/etc/hosts" file using a text editor of your choice.
2. Add the necessary information on the hosts file.
3. Save file. 


Was this answer helpful?

« Back