How do I change the hostname in Linux?
-
To change the hostname dynamically i.e. the change won't be permanent after a reboot:
# hostname <my_hostname>
To make the hostname change permanent i.e. persistent after a reboot:
# vi /etc/hosts
Change the hostname as appropriate, save and exit the file.
# vi /etc/sysconfig/network
Change the hostname as appropriate, save and exit the file.
© Lightnetics 2024