Setting hosts on ubuntu :
Setting host on ubuntu is pretty straight forward. You just need to have sudo user permission to do so.
Type below command (using gedit as editor):
sudo gedit /etc/hosts
It will open hosts file and you can make your changes there.
Using vim editor :
sudo vi /etc/hosts
Setting hosts on Windows 7:
It's very complex to set hosts in windows 7 although you have all administrator rights. Windows restrict you to make any changes in your hosts file.
We don't need to make any permission changes in hosts file (Some time we may forgot to change file permission again to it's original permissions). So first of all we will start with finding the hosts file.
The path to the Hosts file in Windows 7 is the same as usual. open start menu and run :
This will open etc folder in which you find hosts file. You can manually find hosts file also.
C => Windows => System32 => drivers => etc => hosts
Follow below steps :
- Before doing anything create a backup of your hots file.
- Separate copy hosts file to any other location on system (I prefer on desktop).
- Make changes in new file that we have on desktop.
- Replace original hosts file with new one that we have on desktop.
- Restart your system (Not mandatory)
We are done :)