This quick tutorial explains how to change hostname permanently from the Terminal without a restart in Ubuntu 16.04.1.
Open the Terminal by keyboard shortcut Ctrl + Alt + T.
Show current hostname:
hostname
Set new static hostname:
hostnamectl set-hostname YOUR-HOSTNAME
Restart the system service that manages user logins:
systemctl restart systemd-logind.service
Check new hostname:
hostname