How to modify the host name in linux

Source: Internet
Author: User
In linux, you can use the hostname command to temporarily modify the host name. However, after the host is restarted, the original value is restored.

How to modify the host name in linux

You can use the hostname command to temporarily modify the machine name, but the original value will be restored after the machine is restarted.

# Hostname // view the machine name
# Hostname-I // view the IP address corresponding to the machine name


Another method is to modify the configuration file for a long time.

Modify/etc/sysconfig/network to modify this file.
Run the/etc/hosts hostname command to read this configuration file.

Many friends on the Internet say that you can directly modify the/etc/hosts file, but the host name used by the system will not change, so I think
/Etc/hosts is used in the network,/etc/sysconfig/network is used in the local machine, and the Meridian test is also like this, my version is

Linux as3


Conclusion: to modify the host name, both files must be changed.

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.