To sum up the method of modifying the hosts address in Ubuntu, it is actually very simple. You can do it with a few commands, as shown below:
Step 1. Enter the Ubuntu terminal by clicking dash home to see terminal. Click it to open it.
Step 2: Find the hosts file in the/etc folder through several common commands and modify its IP address.
Sudo su -- enter the privileged mode. You must have the permission to modify files in the privileged mode;
CD .. (CD etc) -- return the upper-level directory (enter the ETC folder) (Note: You can also use the absolute path to directly CD to the ETC folder)
Ls -- View All files in the current directory, folder (you can see that there is a file named hosts in the ETC folder)
Step3. open and edit the hosts file
VI hosts -- open the hosts file in the current directory
Press the Insert key on the keyboard to start the input (note: the keypad on the right does not support the input)
After the input is complete, enter (: WQ command) to save and exit.
The hosts file has been modified.