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.