Change hostname on Ubuntu 18.04 LTS

If you have Cloud cloud-ini installed you will have to edit to preserve your new hostname. When that is done, run the rename command Edit /etc/hosts so it corresponds with your new hostname You can verify your changes by running At last, reboot and it should show the correct hostname.