Change hostname on Ubuntu
Check current hostname
Simply run hostname
or hostnamectl
command, or simply echo "$HOSTNAME"
…or look into cat /etc/hostname
Change hostname
- First
sudo hostnamectl set-hostname newNameHere
- Then edit
/etc/hosts
withsudo nano /etc/hosts
- Reboot ‘sudo reboot’ for changes to take effect