To view the host name of Ubuntu, you can view it by command:
Hostname
Modifying the host name requires two files to be changed:
/etc/hostname
/etc/hosts
In the hostname file, change the original host name to a new one. In the Hosts file, you can
Change the original hostname portion of the 127.0.0.1 resolution to the new host name
---------------------------------------------------
1. Modify the Linux server name
# vi/etc/sysconfig/network
Networking=yes
Hostname=yourname//change in this HOSTNAME
2. Modify the name inside the/etc/hosts
# vi/etc/hosts
127.0.0.1 localhost.localdomain localhost
127.0.0.1 yourname//change in this hostname
3. Finally executed under the terminal
#hostname * * * *//***** for modified hostname
The hostname command only temporarily changes the hostname, and the host name is restored to the original after reboot.
To permanently change the host name, you need to modify the/etc/sysconfig/network file.
View Host name command
# Uname-n
#Centos