Linux Commands | Other | Change the Computer (Host) Name
How to change the Linux host name with hostnamectl and verify it with hostname
Changing the Host Name with a Command on CentOS 7 and Later
Run the following command with the new host name.
$ hostnamectl set-hostname [new host name]
After the command runs, close the console and open it again.
Command to check the host name:
$ hostname