Home >Operation and Maintenance >Linux Operation and Maintenance >How to modify hostname in linux
Method: 1. Use the "hostname modified host name" statement to modify the hostname, which will become invalid after the server restarts; 2. Use the "vim /etc/sysconfig/network" statement to modify the hostname, and the server will restart. will take effect permanently.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
How to modify hostname in Linux
1. If you only modify the hostname, you can use the following command
hostname newHostname
Note: This modification method is only valid currently. After the server is restarted, the hostname will become invalid and return to the original hostname.
2. If you need to permanently modify the hostname, you can use the following command
vim /etc/sysconfig/network
to modify the HOSTNAME item, but this method requires It will take effect after restarting.
3. Therefore, the way to permanently modify the hostname without restarting is to combine the above two methods, so that there is no need to restart. It is also effective currently and will also take effect after restarting.
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to modify hostname in linux. For more information, please follow other related articles on the PHP Chinese website!