Change Computer Name / Hostname in Ubuntu 17.04

Change hostname Computer name in Ubuntu

This quick tutorial is going to show you how to change the computer name or hostname in Ubuntu 17.04 Zesty Zapus.

While installing Ubuntu Desktop, there’s a step to create user and setup computer name in the install wizard. If you want to change this name later, follow the steps below one by one:

To change Hostname temporarily:

Open terminal by pressing Ctrl+Alt+T or searching for “Terminal” from start menu. When it opens run command:

sudo hostname NEW_NAME_HERE

Type in your password (no visual feedback due to security reason) and hit Enter.

The command in following picture sets hostname to ubuntu1704-desktop temporarily until next reboot.

temp-change-hostname

Change Hostname permanently:

To permanently change your computer name, edit both /etc/hosts and /etc/hostname files via following steps:

1. Open terminal and run command to install gksu if not installed:

sudo apt install gksu

2. Edit the /etc/hosts file via command:

gksudo gedit /etc/hosts

edit-hosts

3. Edit the /etc/hostname file via command:

gksudo gedit /etc/hostname

edit-hostname

NOTE: In both step 2 and step 3, change the name marked via red box to a NEW hostname.

4. After saving the changes, restart your computer to apply changes.

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.

One comment

  1. [oops my bad, I missed that you did]