hostname is set during the installation process of Ubuntu. Hostname is used for many things especially a an identifier within the local network.
You can change the hostname of your Ubuntu system using hostnamectl command from the terminal.
[email protected]:~$ hostname host
[email protected]:~$ sudo hostnamectl set-hostname newhostname [sudo] password for user:
[email protected]:~$ hostname newhostname
[email protected]:~$ bash [email protected]:~$
This only works if $PS1 is set to display the hostname.
Guide compatibility:
Operating System |
---|
Ubuntu 16.04 LTS (Xenial Xerus) |
Ubuntu 16.10 (Yakkety Yak) |
Ubuntu 17.04 (Zesty Zapus) |
Ubuntu 17.10 (Artful Aardvark) |
Ubuntu 18.04 LTS (Bionic Beaver) |
Ubuntu 18.10 (Cosmic Cuttlefish) |
Ubuntu 19.04 (Disco Dingo) |
Comment anonymously. Login not required.