Setting system hostname using systemd

Sometimes you need to be able to change the hostname of your systemd instance, like when you do a fresh install and forget to change it. You dont even need to reboot for it to make it happen!

Issue the following command, replacing with your own.

Now just log out, and back in, or open a subshell by typing bash again.

sudo hostnamectl set-hostname