Linux: How to change host name in Ubuntu?

2012-06-28 Linux

Process of changing host name in Ubuntu is quite easy. All you have to do is to edit two specific files, modify them and reboot your machine.

Open terminal and (as super user) type:

sudo gedit /etc/hostname

Of course if you have other editor instead of gedit then use it replacing it's name. In editor find current host name and change it to desired one. Save file and exit. Now open the second file:

sudo gedit /etc/hosts

Below the first line (which contains something like " localhost") find host name you wish to modify and change it to new one (same as in first file). Save file, quit editor and reboot your Ubuntu.