[Linux] how to view and modify the machine name in Linux

Source: Internet
Author: User

View the machine name: uname-A modify the machine name: RedHat the first step to modify the Host Name:
# Hostname oratest
Step 2:
Modify the hostname in/etc/sysconfig/Network
Step 3:
Modify the/etc/hosts file
SuSE Linux: Modify the/etc/hostname file and save the host name in this file, for example:
Homer100 then run the command to set the Host Name
#/Etc/rc. d/boot. localnet start

Reprinted from: http://blog.csdn.net/wyzxg/article/details/1840110

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.

# Hostname // view the machine name

# Hostname-I // view the IP address corresponding to the machine name
Another method is to modify the configuration file/etc/sysconfig/network for a long time before the system is effective.
The/etc/hosts hostname command reads 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, and/etc/sysconfig/network is used in the local machine, and the meridian test is also like this. My version is Linux as3 Summary: So you need to modify the Host Name, change both files.

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.