How to Change Hostname (Computer Name) in Ubuntu 19.10

This quick tip is going to show Ubuntu beginners how to change the hostname (computer name) in Ubuntu 19.10 Eoan Ermine.

While installing Ubuntu, there’s a step to create user and setup computer name in the install wizard. If you’ve Ubuntu 19.10 upgraded from previous release, or just want to change the computer name, do following steps one by one.

Change hostname Computer name in Ubuntu

How to change Hostname in Ubuntu temporarily:

To change the hostname or computer name temporarily, so it works until next reboot.

Open terminal either from application menu or by pressing Ctrl+Alt+T on keyboard. When it opens, run command:

sudo hostname NEW_NAME_HERE

Type user password (no asterisk feedback) when it prompts. In the picture, I changed my computer name to Ubuntu-1910:


Change hostname in Ubuntu permanently:

There are a few graphical utilities offer option to change the computer name depends on your running desktop environment.

The universal way is to edit the configuration file /etc/hostname:

1. Open terminal from application menu, and run command to edit the file:

sudo gedit /etc/hostname

You may replace gedit with nano for Ubuntu Server, or with other text editor for your DE.

When the file opens, replace the content with your new computer name:


2. To avoid networking issue, you HAVE TO edit the hosts file and replace the old computer names.

Open terminal (Ctrl+Alt+T) and run command:

sudo gedit /etc/hosts

Also you may replace gedit with your favorite text editor.


About ml

ml is a part time stay-at-home dad who've been using Ubuntu Desktop for a few years. He writes in the free time and wishes to share some useful tips with Ubuntu beginners and lovers.


  1. how to rename ml@ubuntu18-04. I know how to change the hostname , I want to change the *ml* part only

Leave a Reply

Your email address will not be published. Required fields are marked *