How to edit your hosts file in Ubuntu. It is little easy when compared to Windows. Open your terminal and type this:
sudo gedit /etc/hosts
This will ask for your root password and open gedit. Now you can add your entries there and save it without any trouble.