How to change Hostname in Ubuntu 18.04/18.10 Server
—
As you know - hostname it is name of computer and its identifier in the local network. It is computer's name which is indicated in setup of Ubuntu. Below you can find instruction how to change hostname in working system without restarting.
How to know computer's name
For checking name of computer is used next command:
For checking name of computer is used next command:
hostnamectl
in the displaying of this command hostname is displayed in Static hostname
How to change hostname
if you want to change hostname of computer, you need to use command - hostnamectl below in command line:
if you want to change hostname of computer, you need to use command - hostnamectl below in command line:
sudo hostnamectl set-hostname YOUR_HOST_NAME
Also needs to change name of host in file: /etc/hosts. You can do it in command line using editor nano:
sudo nano /etc/hosts
After changing hostname in nano you need to to click CTRL+O for saving file and CTRL+W to exit from editor.