Change Hostname Of A System
Last updated
Last updated
Typically, hostname of a system is stored in /etc/hostname
, and we can change that by writing a new hostname in /etc/hostname
file.
Edit /etc/hostname
with any text editor such as nano or vim, and replace the existing hostname -
Save and reboot -
Using hostnamectl
command we can also set hostname, following is an example -
To display current hostname, we can use hostname
command.
Source: