You get a bonus - 1 coin for daily activity. Now you have 1 coin

How to change the computer name (hostname) in Linux Debian (or Ubuntu)

Practice



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

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Computer networks"

Terms: Computer networks