How to change your computer’s name

This is just a quick article to show you how to change your computer’s name.

To see your computer’s name click on the icon in the top right corner and click on “About This Computer”.



As you can see the name of my machine is gary-SATELLITE-PRO-L870-149. This was set up when I first installed Ubuntu.

This article serves 2 purposes.

  1. You will learn how to use the command line
  2. You will find out how to change your computer’s name.

To open a terminal press the super key and start typing the word “Term”. ┬áThe terminal application will appear in the dash. Click on the icon for terminal.

A command prompt will appear. The tool we are going to use is called nano and it is a basic text editor. In the terminal enter the following command:

sudo nano /etc/hosts

At this point you will be asked for your administrator password. sudo enables you to run commands as if you are the administrator. You need sudo in this instance because you will be editing a file that is outwith the general permissions of the user you are logged in as.

After you enter the password the following screen will appear.


As you can see my computer’s name is listed in this file, changing this text changes my computer’s name. To save the file press CTRL and O and to exit press CTRL and X.

You also need to edit the file hostname so type:

sudo nano hostname

Your previous computer name will once again be listed. Change this name to the new computer name (the same one you entered into the hosts file). Press CTRL and O to save and then CTRL and X to exit.

Finally type exit to exit the terminal and reboot your computer.

Now when you check the “About This Computer” screen you will see that the name has changed.


Thankyou for reading

Leave a Reply