Kiến Thức Linux

How to Change Hostname (Computer Name) in Ubuntu 19.10

Change hostname Computer name in Ubuntu

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.


Đăng ký liền tay Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !

Add Comment

Click here to post a comment

Đăng ký liền tay
Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !