How to modify the hosts file in Ubuntu

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.