How do I change the hostname without a restart?
Without restart:
Update new hostname
sudo vim /etc/hostname
also update sudo vim /etc/hosts
accordingly
sudo sysctl kernel.hostname=mynewlocalhost
When done check your current hostname with hostname -f