Configure Hostname on Ubuntu Machine
Its easy to configure a hostname on an Ubuntu machine. You can use the command line tool hostnamectl. Lets see how its done:
- Open the terminal on your Ubuntu machine.
- Run one of the commands below to display the current hostname.
- Set the hostname using the command below , replacing “new_hostname” with the desired hostname.
- Confirm the new hostname.
- Additionally, you can also edit the file “/etc/hostname” and change the hostname to your desired one and reboot the machine to take effect.
$ hostname
$ hostnamectl status
$ sudo hostnamectl set-hostname new_hostname
$ hostname
Enjoy!!