change hostname in ubuntu 20.04 code example
Example: change hostname ubuntu 20.04
#Change hostname
sudo hostnamectl set-hostname newHostName
#Edit the /etc/hosts file, and replace existing hostname with a new hostname.
sudo nano /etc/hosts
#Reboot the system to changes take effect
sudo reboot