Home  >  Article  >  Operation and Maintenance  >  How to modify hostname in linux

How to modify hostname in linux

WBOY
WBOYOriginal
2021-12-27 15:16:3021631browse

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.

How to modify hostname in linux

#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.

How to modify hostname in linux

How to modify hostname in linux

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn