How to Change Your Computer Name in Ubuntu

If you ever wished to change your computer name, here is how to do it. Many people think that this is possible only if you do reinstall the operating system, but this is not true. There are few commands to make job done. Just follow the...

Method 1 of 7:

Open the Run dialog And Gnome Text Editor

  • Picture 1 of How to Change Your Computer Name in Ubuntu

    Open the Run dialog by pressing on Alt+F2 buttons on your keyboard.

  • Picture 2 of How to Change Your Computer Name in Ubuntu

    When Run dialog is opened, you need to type following command or to use copy/paste method: gksu gedit /etc/hostname

  • Method 2 of 7:

    Enter Password

  • Picture 3 of How to Change Your Computer Name in Ubuntu

    After you hit Enter or click on the 'Run' button, you'll be asked for a password, so type password and hit Enter.

  • Method 3 of 7:

    Use Gnome Text Editor

  • Picture 4 of How to Change Your Computer Name in Ubuntu

    A new window will open, which is Gedit. In some cases it will say 'PC', but in your case, you may see some different name, so in that window replace the text with your desired name.

  • Picture 5 of How to Change Your Computer Name in Ubuntu

    Don't forget to save your file before closing the file. You can do that if you click on 'Save' icon or just hit Ctr+S buttons. After that, close Gedit.

  • Method 4 of 7:

    Open the Run dialog

  • Picture 6 of How to Change Your Computer Name in Ubuntu

    Open the Run dialog again by pressing on Alt+F2 buttons on your keyboard.

  • Picture 7 of How to Change Your Computer Name in Ubuntu

    When Run dialog is opened, type in the following command or to use copy/paste method: gksu gedit /etc/hosts

  • Method 5 of 7:

    Enter Password

  • Picture 8 of How to Change Your Computer Name in Ubuntu

    After you hit Enter or click on 'Run' button, it will ask you for the password. Type password and hit Enter.

  • Method 6 of 7:

    Use Gnome Text Editor

  • Picture 9 of How to Change Your Computer Name in Ubuntu

    Now for the second time, Gedit is opened. In may say 'PC' again (last line of the first block), so in that window, replace the text with the same desired name that you choose last time.

  • Picture 10 of How to Change Your Computer Name in Ubuntu

    Don't forget to save your file before closing it. You can do that if you click on 'Save' icon, or just hit Ctr+S buttons. After that, close Gedit.

  • Method 7 of 7:

    Use Terminal

  • Picture 11 of How to Change Your Computer Name in Ubuntu

    The last step is to restart your system. When you're back on desktop again, open a Terminal (To open Terminal, press Ctrl+Alt+T on your keyboard or go to Applications > Accessories > Terminal, which is located in main menu ) window and you should see that your computer name has changed.

  • Isabella Humphrey Isabella Humphrey

    Update 04 March 2020

    ncG1vNJzZmismaXArq3KnmWcp51ktbDDjK2mZpuYlruosYyypq6qXZi8rrzUrZyrZZ6WuqZ5yKdkrpqlo8G2