Illustration: modify the computer name in ubuntu

Source: Internet
Author: User
After installing ubuntu last time, I want to install VMwareTools in ubuntu, open the terminal, and find that my ubuntu computer name is a long string, as shown in the figure below, it looks uncomfortable, I decided to change the computer name first. You can use the hostname command to query information online...

After ubuntu was installed last time, I want to install VMware Tools in ubuntu and open the terminal. I found that my ubuntu computer has a long name, as shown in the following figure, looking uncomfortable, I decided to change the computer name first.

You can use the hostname command to modify the information on the internet. the hostname command format is as follows:
Hostname <New computer name>
-$ Sudo hostname linux
After the modification, the new terminal window is displayed, showing that the modification is successful, as shown in:

Restart the ubuntu system and find that the modified computer name is not saved. It is changed back to the computer name before modification.
Continue to find the method, which is to modify the/etc/hostname file. The method is as follows:
-$ Sudo gedit/etc/hostname
Enter the password and go to the text editor. the displayed content is as follows:

Modify the name of the computer you want to set. I will set it to "linux ". Restart the terminal and start the terminal. the computer name is updated on the terminal.
I heard that only modification of/etc/hostname will cause problems sooner or later. As for the problem, I still don't know, but I still need to modify/etc/hosts. Open the/etc/hosts file:
-$ Sudo gedit/etc/hosts
The file content is shown in:

I changed the name in 127.0.1.1 to the same name in/etc/hostname.
So far, the operation to modify the computer name is complete.
The following is a summary of modifying the computer name:
-$ Sudo gedit/etc/hostname
-$ Sudo gedit/etc/hosts

 
This article is from the happy IT life blog of Doudou Xiong.

Related Article

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.