Make hosts file editable with out sudo
hosts file allow you to override DNS. This will allow you to point a domain to difernt IP address on your computer. It is helpful for testing sites during site migrations.
If you edit hosts file a lot, it is better to make it owned by you or make it editable by everyone.
sudo chmod 777 /etc/hosts
Now onwards, you can edit the file with out sudo requirment.
Another option is make it owned by current user.
sudo chown USER_HERE:GROUP_HERE /etc/hosts
See /etc/hosts