How do I change the hostname (without a restart)?

Instructions how to change the host name permanently and instantly.

Step 1: 
Edit hostname file

If you want to change the Host name permanently you can edit the file hostname which is stored in the /etc folder sudo gedit /etc/hostname

Step 2: 
Reboot the system

The hostname will be changed after reboot. If you want to change the hostname instantly without rebooting, you can do it with the following command: sudo hostname your-new-name