To change the hostname (i.e. the computer name) on Ubuntu Linux, you can use the following steps:
/etc/hostname
file in a text editor (e.g. nano
). This file contains the current hostname of the system.sudo nano /etc/hostnameSourec:www.lautturi.com
Replace the current hostname with the desired hostname and save the file.
Open the /etc/hosts
file in a text editor. This file maps hostnames to IP addresses.
sudo nano /etc/hosts
Replace the current hostname with the desired hostname in the 127.0.0.1
line and save the file.
Reboot the system for the changes to take effect.
sudo reboot
After the system has rebooted, the hostname should be changed to the desired value.
Keep in mind that changing the hostname can have unintended consequences, as some applications and services may rely on the current hostname to function properly. It is always a good idea to test your system after changing the hostname to ensure that everything is working as expected.