Hostname or computer name is used to identify a system to the local network. On Ubuntu, you can see the hostname of your system when launching the terminal.
You first set the system's hostname during Ubuntu's installation. Hostname information is stored on the /etc/hostname file. You can change the hostname of your Ubuntu system at any time after the installation by manually editing the /etc/hostname file or by using a helper program such as hostnamectl.
user@host:~$ hostname host
user@host:~$ sudo hostnamectl set-hostname newhostname [sudo] password for user:
user@host:~$ cat /etc/hostname newhostname
user@host:~$ hostname newhostname
user@host:~$ bash user@newhostname:~$
This only works if $PS1 is set to display the hostname.
user@newhostname:~$ sudo reboot
Comment anonymously. Login not required.