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