To change the hostname of a Linux system, you can use the hostname
command. The hostname is a unique name that identifies a device on a network.
To change the hostname, use the following syntax:
hostname NEW_HOSTNAME
Replace NEW_HOSTNAME
with the hostname you want to use. This will change the hostname of the system to the specified name.
To make the change permanent, you will need to edit the /etc/hostname
file and set the hostname in the file to the new hostname. Open the /etc/hostname
file with a text editor, such as vi
or nano
, and replace the current hostname with the new hostname. Save the changes to the file and exit the text editor.
You may also need to edit the /etc/hosts
file to reflect the new hostname. In the /etc/hosts
file, you will need to change the hostname in the first line of the file to the new hostname.
After making these changes, you will need to reboot the system for the hostname change to take effect.
By following these steps, you should be able to change the hostname of a Linux system. If you encounter any issues during the process, you may need to seek assistance from a qualified Linux administrator.