How to modify hosts file on windows and linux ?

Below is how to locate and edit the hosts file on several OS platforms. Once the proper domain information is added you will save the file and your system will begin resolving to the specified IP. Once testing is finished these entries should be removed.

Windows 8, Windows 7 and Windows Vista

Windows 8, Windows 7 and Windows Vista use User Account Control (UAC), so Notepad must be run as Administrator.

For Windows 8

  1. Press the Windows key.
  2. Type Notepad in the search field.
  3. In the search right click Notepad and select Run as administrator.
  4. In Notepad, open the following file:
    c:\Windows\System32\Drivers\etc\hosts
  5. Make the necessary changes to the hosts file.
  6. Click File -> Save to save your changes.

For Windows 7 and Windows Vista

  1. For Click Start -> All Programs -> Accessories.
  2. Right click Notepad and select Run as administrator.
  3. Click Continue on the "Windows needs your permission" UAC window.
  4. When Notepad opens Click File -> Open.
  5. In the filename field type:
    C:\Windows\System32\Drivers\etc\hosts
  6. Click Open.
  7. Make the necessary changes to the hosts file.
  8. Click File -> Save to save your changes.

Linux

  1. Open a terminal window.
  2. Open the hosts file in a text editor (you can substitute any text editor):
    sudo nano /etc/hosts
  3. Enter your password.
  4. Make the necessary changes to the hosts file.
  5. Press control-X (hold control and hit X), then answer y when asked if you want to save your changes.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Flush DNS Cache

Flush DNS cache in Windows 7 and Vista Hit Windows key and type in cmd (do not hit enter). In...

How to run a traceroute on Windows XP/Vista/7/8 and MacOS

Running a Traceroute on Windows XP/Vista/7/8: 1. Go to Start and choose "Run" (start button on...

How to setup Chrome Remote Desktop

Step 1 Open Chrome Browser and Sign into Google Account. You need to be logged in to initiate or...

How to modify your hosts file on a mac ?

STEP 1Open the Mac's Terminal. You may either type Terminal on the Spotlight, or by going into...

How to Identify a Phishing or Spoofing Email

Don’t trust the display nameA favorite phishing tactic among cybercriminals is to spoof the...