how to change the host name in ubuntu code example
Example 1: how to change hostname in ubuntu
#1- Delete the old name and setup new name
sudo hostnamectl set-hostname newHostname
#2- Edit the /etc/hosts file:
sudo nano /etc/hosts
#3- Reboot the system
sudo reboot
#4- To check the new hostname
hostnamectl
Example 2: linux change hostname
sudo nano /etc/hostname
sudo nano /etc/hosts
sudo reboot
Example 3: ubuntu chang host name
Type the following commands:
$ sudo hostname new-server-name-here