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.