How to Change Hostname in Ubuntu 16.04 (Change Computer Name)






How to Change Hostname in UbuntuIn this tutorial we will see How to Change Hostname in Ubuntu 16.04.  This method will work without the need of restarting your computer.

The host name is set by default at the time of installing Ubuntu operating system. But it can be easily changed.

There are two ways to change the Computer Name.

 Temporarily change the hostname 

We can change the hostname  temporarily i.e. it will work till the computer is restarted. For this just open your terminal (short key Ctrl+Alt+T) and run the following command:

After running the above command, Just open the new terminal. In the new terminal you will see the new host-name.

 Change the hostname using  hostnamectl

Check the current hostname on Ubuntu using hostnamectl

the output for the above command

hostnamectl status

Change the current hostname on Ubuntu using hostnamectl

Now after changing the hostname, Just open the new terminal. Now, we can verify the hostname using the hostnamectl status again.

new hostname 2

More hostnamectl command options

hostnamectl --help