There are times when we have to change the name of our team, either for work reasons or for simple taste, and we don’t know where to do it.
Rename the PC a Ubuntu or any of its variants – and other distributions – is extremely simple, just edit the files hosts i hostname located in / Etc /. This can be done with any text editor graphically or directly from the console with the help of GNU nano.
Let’s try first with GNU nano.
Open a console and type:
sudo nano /etc/hosts
You will get a screen like this:
In my case “linux” is the name of the computer. Navigate with the arrows on your keyboard to the name of your computer and change it to new. When finished press Control + O and confirm that you want to save the file by pressing Enter. Now exit by pressing Control + X.
Now the file hostname:
sudo nano /etc/hostname
Only your computer name is in this file. Change it and perform the same steps described above to save and close.
Ready, that’s all you need to do. You can restart your computer if you wish.
If you want to do it graphically you can use Gedit. Open a console and type:
gksudo gedit /etc/hosts
gksudo gedit /etc/hostname
To edit each of the files.
Don’t forget to change gedit by your favorite text editor. If these for example in KDE you could use Kate instead, changing further gksudo per kdesudo:
kdesudo kate /etc/hosts
kdesudo kate /etc/hostname
Learn more – Shorten links from the console, Yakuake, the KDE drop-down console