Home>Article>Operation and Maintenance> How to permanently change the host name in Linux
Method: 1. Use the vim command to open the network file, the syntax is "vim /etc/sysconfig/network"; 2. Modify the value of the "HOSTNAME" item in the file, that is, modify the host name; 3. Use "wq" save changes and exit; 4. Restart.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
How to permanently modify the host name in Linux
#If you want to permanently modify the Linux host name and it will take effect after restarting, then you need to change the following configuration document.
etc/sysconfig/network to configure the host name.
Use the following command to modify:
vim /etc/sysconfig/network
The example is as follows:
where Mylinux is the host name to be set, then save and exit. Restart the system and you will read the configuration file and set the host name to the new hostname.
After we modify it, we need to restart it to take effect permanently. Instead of restarting the network, /etc/init.d/network restart is useless because this is the configuration file read at startup.
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to permanently change the host name in Linux. For more information, please follow other related articles on the PHP Chinese website!