Change hostname of Ubuntu machine

This How to guide come in handy when you need to change the hostname of Ubuntu server machine. To change hostname in Ubuntu server, login to root user or a root privileged user and run the below command.

For root privileged users

sudo vi /etc/hostname

And now type the new hostname of your Ubuntu 14.10 server and perform a reboot to take effect the new hostname.

You can also change the server’s hostname temporarily by running the below command. Note the new hostname is a temporary one, and will revert to the default/old hostname after a reboot

sudo hostname <NewHostname>

To view the hostname of any Ubuntu machine, run te below command

hostname

Tags: