How to: Change Hostname on Ubuntu 14.04

created by BasicSysAdmin

Tags: Linux, Ubuntu, Ubuntu 14.04

Jul 27, 2016

You can change the hostname on ubuntu via the terminal using the following command

sudo hostname [newhostname]

You may need to open up a new terminal window for you to see this change. To make this determinant, you can edit the following two files by replacing the previous hostname to the new one.
sudo nano /etc/hostname

sudo nano /etc/hosts

If you wanted to give this a reboot, you will see that this is now using the new hostname!