Recently, we wanted to change the hostname of our Ubuntu machine,
$ lsb_release -aLets, check now what is current hostname,
$ hostname
new-hostnameSo, its set to “new-hostname”
Now, to change the hostname lets say “my-netbook”, user the command as,
$ hostnamectl set-hostname my-netbookNow, open a new terminal and verify that its changed,
$ hostname
my-netbookSo, its now changed 🙂
In certain case, using sudo you might get an error like “unable to reolve host” to resolve this follow “How to Fix : sudo: unable to resolve host my_user: No such file or directory”