Any user who has installed Linux on their computer will have seen the step in which we choose our username, password and computer name. By default, many Linux distributions name the machine "Username" - "PC-Model", which can be translated as "pablinux-Aspire-One-MODEL". Personally, I have never liked that name and in this step I change it to another. If, for whatever reason, we want change team name After the operating system is installed, most Linux distributions do not have any options available in the settings.
As almost always with almost everything in Linux, we can do this by middle of terminal. Unlike other changes such as the Username, change the team name, which is also known as hostname, it is something simple and totally safe. You will only have to make two changes divided into several steps that we explain below.
Changing the team name is completely safe
- The first thing we will do is open the terminal, something we can do with the shortcut Ctrl + Alt + T in many Linux distributions.
- We introduce the following command, where we will have to change "newname" by the name we want to use:
sudo hostname nuevonombre
- Next, we write the following and enter the password of our user:
sudo nano /etc/hosts
- The above will open the editor of our hosts. There we have to change the name of our team and put the new one. We can move through the editor with the scroll keys of our PC.
- Once changed, we press Ctrl + O to save and Enter to confirm the changes.
- Finally, we exit with Ctrl + X.
At no point in the process will we see any changes. To see it, the best we can do restart terminal, at which time we will see the name of our user, the at sign and the new name of the team. I used to use the same name as the user, but it never convinced me. Now I have opted to put the version of the operating system that I am using, in this case K (ubuntu) 1904. It is important to mention that if we put the point, it will only accept the first part, which in this example would be "19".
If the above method does not work for us, we can also use the command nmcli. With the following command we will see the general name of the equipment:
nmcli general hostname
To change the name of the team, we will add a new name to the previous command, which in my example would look like this:
nmcli general hostname K1904
Was this little tutorial on how to change the machine name in Linux helpful to you?