How to modify the Linux computer name

  
Linux actually provides three ways to modify the computer name: 1) hostname command #hostname → can view the current computer name #hostname computer name → can modify the computer name 2) /etc /hosts # vi /etc/hosts program code # Do not remove the following line, or various programs# that require network functionality will fail.127.0.0.1 localhost.localdomain localhost192.168.0.2 dhcpserver dhcpserver~~ where 192.168.0.2 dhcpserver dhcpserver is my later add of. 3) /etc/sysconfig/network#vi /etc/sysconfig/network program code NETWORKING=yesHOSTNAME=dhcpserver~~HOSTNAME=dhcpserver is the setting of the computer name. I tested it. 1) The method is not working. After the restart, it is restored. It just displays the computer name and temporarily modifies it. Some people say 2) no, the restart will resume. So I am modifying 2) and 3) at the same time, then restart, it will be fine.
Copyright © Windows knowledge All Rights Reserved