How to Change Host Name in Linux Ubuntu

Hostname is the name of the computer, which is when we install Ubuntu we are prompted to enter a computer name. Usually the hostname appears in the terminal after the @ sign (@hostname). If you ever want to change the hostname, you can do it in two ways:
  • Using The GUI
  • Command Line
We will do both ways. In this way could also be implemented in Linux Mint, Debian, distros, and which is still in the family, due to its configuration is the same.

What HOSTNAME in Linux?
Hostname is the name given to a computer in a network. Basically the hostname is simply the name of the computer, which is used to identify a computer on a network. Hostname is also displayed in the terminal.

As you can see above, his username is ROOT, while the hostname is KALI.

This hostname should uniquely identify a computer on the network. There are some rules that are specified for the hostname. Hostname can only contain letters, digits, and hyphen characters, and period characters. A hostname must begin and end with a letter or number. hostname should be between 2 and 63 characters.

You can change Your hostname as you want, but You should not use the same hostname on two different computers in a network, as this can cause problems.

Changing The Hostname Using The GUI
To change the hostname using the GUI, the first step you have to do is open the "System Settings". After that select "Details".

You will see a column to change the name of the device. Change "Device Name".

When you check the hostname in the terminal then it changed. to see the changes you can type in a terminal:

Changing The Hostname Using The Terminal
Apart from the above ways, you can also change hostaname by using the terminal, follow the steps below:
sudo nano /etc/hostname

Open a terminal. To change Your hostname, you will need to edit the file "/etc/hostname" you, which Ubuntu, Mint and other Debian-based distributions save hostname here.

Then the Fox to your liking. To see the changes you will need to restart the computer.

Click here for Comments