Change Linux hostname
Change Linux hostname
1. Check the current Ubuntu hostname
hostnamectl
2. Change the Hostname
sudo hostnamectl set-hostname newNameHere
3. Edit the hosts file
sudo nano /etc/hosts
Replace any occurrence of the existing computer name with your new hostname.
4. Reboot the system
sudo reboot now