Modify /etc/hosts file in Ubuntu Command line using nano text editor

FloraH
May 14, 2021

--

adding a new IP address
  1. Check if you have nano installed:

nano --version

if not found type:

sudo apt install nano

2. To modify the hosts file on Ubuntu 18.04, type in the command:

sudo nano /etc/hosts

3. Enter your password

Now the nano editor would pop up in the terminal like the one above!

the hosts file can only be modified by root users so make sure to use sudo

4. Add the new IP address at the bottom

185.199.108.133 raw.githubusercontent.com

then ctrl+o to save the file

ctrl+x to exit the file, DONE!!

ctrl+c to undo the last command

for other operations check nano basic guide

live demonstration on youtube by Cameron McKenzie

Also a great reference here

--

--