This simple and brief tutorial is going to show you how to change the Hostname / Computer name in Ubuntu 14.04 Trusty Tahr.
The default name was set when you were installing Ubuntu. You can easily change it to whatever you want in both Desktop & Server by editing the hosts and hostname files. Below is how:
1. Press Ctrl+Alt+T on keyboard to open the terminal. When it opens, run the below command:
This will change the hostname until next reboot. The change won’t be visible immediately in your current terminal. Start a new terminal to see the new hostname.
2. To change the name permanently, run command to edit the host files:
sudo gedit /etc/hostname /etc/hosts
For Ubuntu server without a GUI, run
sudo vi /etc/hostname and
sudo vi /etc/hosts and edit them one by one.
In both files, change the name to what you want and save them.