Android environment configuration: ubuntu host name Modification

Source: Internet
Author: User

Http://www.33lc.com/article/4015.html


1. view the Host Name


In Ubuntu, there are multiple methods to quickly view the Host Name:
1. Open a GNOME terminal window and you can see the host name in the command prompt. The host name is usually located after the "@" symbol;
2. Enter the hostname or uname-n command in the terminal window to view the Host Name of the current host.

2. Temporarily modify the Host Name

Run the following command on the command line: "hostname new host name"
The "New Host Name" can be expressed by any valid string. However, in this way, the new host name is not stored in the system. After the system is restarted, the host name will be restored to the original host name.
Example: hostname ubuntu-temp
In this way, the host name will be changed to ubuntu-temp temporarily, but the host name will not be immediately displayed in the terminal, and a terminal window will be re-opened (the terminal connected through ssh needs to be re-connected );


3. Change the host name permanently.

It is also easy to change the host name permanently in Ubuntu. The host name is stored in the/etc/hostname file. When modifying the host name, edit the hostname file, enter a new host name in the file, and save the file. After the system is restarted, check whether the host name is successfully modified by referring to the method described above to quickly check the host name.

Value indicates that not all other Linux distributions have the/etc/hostname file. For example, the ora release stores the host name in the/etc/sysconfig/network file. Therefore, when modifying the host name, you should be aware of the Linux release.

3. Differences between/etc/hostname and/etc/hosts
The host name is stored in/etc/hostname. An example of the hostname file is as follows:
V-jiwan-ubuntu-temp

/Etc/hosts stores the correspondence between the domain name and the ip address. The domain name and the host name are irrelevant. You can specify any name for any IP address. An example of the hostname file is as follows:
127.0.0.1 localhost
127.0.1.1 v-jiwan-ubuntu

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.