Add Entry To Hosts File To edit to your hosts file start by opening your terminal. Then run the following command: sudo nano /etc/hosts When you are prompted for your password enter it.