Type "sudo -i gedit /etc/hosts".
That will open the hosts file:
Let's say you want to add "yoursite.com" to your local machine then you can add the following line at the last of that file:
You can save the file and close it. Ping that site to confirm that etc/hosts file modification worked: