This article covers how to change the hostname on Ubuntu 18.04 system using multiple methods. HostName is also referred to as the computer name of your system. It is used to identify the device in various forms of electronic communication in the computer network. Hostname helps you to access local web pages and other authorized data on your system.
The host name or computer name is usually at system startup in /etc/hostname file.
How to change the computer name on Ubuntu Linux ?
1. Type the following command to edit /etc/hostname using nano or vi text editor:
$ sudo nano /etc/hostname
Delete the old name and setup new name.
2. Next Edit the /etc/hosts file:
$ sudo nano /etc/hosts
Replace any occurrence of the existing computer name with your new one.
3. Reboot the system to changes take effect:
$ sudo reboot