Task: change the computer name.
1) Changing the name "here and now":
$ sudo hostname newname
This command changes the current computer name to "newname".
But after a reboot the name will revert to its old value.
2) Changing /etc/hosts
It's not enough to change the name via hostname - you need to open the /etc/hosts file and change the old name to the new one everywhere it's listed. For example, for the address 127.0.0.1.
3) Changing the hostname file - setting the name permanently
Now go to /etc, open the hostname file, whose only entry is the old computer name. Change the name to the new one.
That's it, the name has been changed.
Comments