How to Install Your Computer Name in Ubuntu 20.04

Change hostname Computer name in Ubuntu

Want to change computer name (hostname) in Ubuntu 20.04 LTS? There are a few ways while this one will work in both Ubuntu Server and Desktop with any desktop environment.

1. change Hostname in Ubuntu temporarily:

To change the hostname or computer name temporarily, so it works until next reboot, simply open terminal by either pressing Ctrl+Alt+T on keyboard or searching for ‘terminal’ from system application menu.

When terminal opens, run command:

sudo hostname NEW_NAME_HERE

Type your password, no asterisk feedback, for sudo prompt and hit Enter.

2. change Hostname in Ubuntu permanently:

The universal way to change the hostname is just editing the /etc/hostname configuration file.

1.) Open terminal and run command to edit the file:

sudo gedit /etc/hostname

When the file opens, type new name to replace the original one.

For Ubuntu Server, run sudo nano /etc/hostname instead. And press Ctrl+X, follow by Y, and finally hit Enter to save change.

2.) Also change the hosts file to avoid networking issue, by running command to edit the file:

sudo gedit /etc/hosts

When it opens, replace the old hostname and save it.

That’s it. Enjoy!

Source Article