linuxubuntu

Ubuntu – changing the hostname

1 min read

To change the hostname of an Ubuntu installation, you can run the following commands:

text
sudo hostnamectl hostname <newname>
sudo bash -c "sed -i 's/<currentname>/<newname>/g' /etc/hosts"

Then reboot, to make sure there are no problems with services that were started before the change.

#ubuntu