Changing computer name in Ubuntu is easy.In Linux computer name is represented as ‘hostname’ and this name can be used to identify a Linux box in a network. To display current hostname on your linux machine

1
$ hostname

To change hostname for current session

1
$ hostname new_host_name.my_domain

To change hostname permanently


  1. Open /etc/hostname file as root

  2. 1
    $ sudo vi /etc/hostname


  3. Change the name and save the file

  4. New hostname will take effect after the reboot.

  5. You will also need to update the /etc/hosts file with the same computername

Note that, the new name will take effect after you restart the machine. If the same hostname is configured on any other machine in the network, system may fail to boot or won’t be available in the network.