- Replace your old hostname in the /etc/hostname file with the new one: “sudo vi /etc/hostname”
- Replace your old hostname beside the 127.0.0.1 in the /etc/hosts file
- Run the following “sudo service hostname start”
- Exit the terminal and open a new one, you’ll find the new hostname applied
Source: http://www.subvs.co.uk/ubuntu_change_hostname_computer_name
Or just use this command after you changed the name in /etc/hostname
hostname -F /etc/hostname and the hostname will be changed
LikeLike