How do i change the computer name in Ubuntu MATE 16.04 LTS

Hey evryone! I’m a new user of Ubuntu and during he installation i didn’t pay much attantion and didn’t set a computername. The name now annoys me. Can anyone tell me ho can i change it?

Hostname is stored in 2 files.

  1. /etc/hosts
  1. /etc/hostname
    

There might be a method to change the computer's name using a gui but I couldn't find one.

  1. enter terminal from menu Applications > System Tools > MATE Terminal (keyboard short cut = Ctrl + Alt + t)
  1. make a copy of both files using this command - you will be prompted for your password and there will be no indication while you're typing
    sudo cp /etc/hosts /etc/hosts.bu && sudo cp /etc/hostname cp /etc/hostname.bu
  2. open /etc/hosts in a gui text editor using this command - you will be prompted for your password
    gksudo pluma /etc/hosts
    replace the computer name with your choice; in a default setup this should be on line 2
    remember to save the file
    using pluma's menu open /etc/hostname
    replace the computer name with your choice; in a default setup there's one line
    remember to save the file
  3. reboot your computer
2 Likes

@pfeiffep
when i go:
sudo cp /etc/hosts /etc/hosts.bu && sudo cp /etc/hostname cp /etc/hostname.bu
i get:
cp: target ‘/etc/hostname.bu’ is not a directory

my bad

prior to using the 2 commands starting with sudo
cd /etc
then
sudo cp hosts hosts.bu && sudo cp hostname hostname.bu

1 Like

@pfeiffep Thank you! It worked!

1 Like

Glad it worked out for you. So others might benefit please mark the selection solved ... look for the solution check box like John did in this thread

1 Like

Since 'gksu' has disappeared from ubuntuMATE version 18.04, the following will work for step 3 above:
(for newbies)

  1. type: gedit admin:///etc/hosts [return]
    (will have to authenticate with your password; ignore warnings)
    change 2nd line in edit window from old computer name to new name, then SAVE.

type: gedit admin:///etc/hostname [return]
(will have to authenticate again; ignore warnings)
change first (or probably only) line in edit window from old name to new name, then SAVE.

  1. Reboot computer.