1) Open Terminal in Linux
2) Open the hosts file in Terminal
Once inside the Terminal console, make sure you are in the top-level folder by typing the command:
cd /
The path to the hosts file on Linux is:
/etc/hosts
Editing the file requires administrative privileges (sudo) and a text editor such as Nano. Use the following command to open and edit the file:
sudo nano /etc/hosts
The system will prompt you to provide the administrator’s password before opening the file. After you type the password, press Enter

3) Edit the hosts file in Terminal
With the arrow keys, place the text cursor under the last written line and add the hostname settings. In our case, we are adding an address with the hostname my-new-website.com. Therefore, the line should read:
Add an entry on the file containing the IP address that was copied in the previous step followed by a space then the domain name
35.214.215.226 my-new-website.com www.my-new-website.com

To confirm the new changes, press the key combination Control + O and press Enter. You can then exit the editor by pressing Control + X.