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
$ hostname
To change hostname for current session
$ hostname new_host_name.my_domain
To change hostname permanently
- Open /etc/hostname file as root
- Change the name and save the file
- New hostname will take effect after the reboot.
- You will also need to update the
/etc/hosts
file with the same computername
$ sudo vi /etc/hostname
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.