How to modify a hosts file in Windows 7, Windows 8/10, Mac OS and Ubuntu?

By Editing Host File, you can point IP Address for a Domain in your local system.

 

Windows 7 :

 

Note : You can also use these steps to modify host file in Windows 8/10 as well.

 

  1. Press Windows+R to open Run.

  2. Enter Below Command to open host file in notepad.
# notepad c:\windows\system32\drivers\etc\hosts
 
  1. Modify the required line and save your changes.



 

Ubuntu :

 

We will use nano editor to modify host file in ubuntu. You can use your favorite editor. You can find host file at path /etc/ folder. We logged in as root user here. You can use sudo if you are not logged in with root user.

  1. Hit below command.
# nano /etc/hosts

          

  1. Modify the Required line and save your settings by ctr+x Button. Press Y to complete save changes.



Mac OS X : 

 

You will find the host file in MAC OS at the same path as we see in Ubuntu.

  1. Open a GUI Text Editor.

  2. Access the file at /etc/ folder using below command.
# vim /etc/hosts
  1. Modify your changes and save the Host file.

Related Articles

How to Serve Scaled Images on Your WordPress Website using plugins?

If you have tested your website in a performance testing tool and asking you to serve the scaled...

Receiving unexpected T_STRING error.

If you are receiving this error, this means .html files are parsed as PHP. In case, your .html...

How to enable "I'm Under Attack" mode in CloudFlare Panel?

Cloudflare provides additional protection called "I m under attack" for a website which is under...

Comparison of control panels Plesk VS WHM/cPanel.

Web Hosting control panels are very useful to manage your servers with a front-end graphical web...

Comparison between Plesk and SolidCP ControlPanel.

Please refer to the below table which is showing the comparison between Plesk and SolidCP Control...

  • 0 Users Found This Useful

Was this answer helpful?