Update the hostname using the hostnamectl command:
sudo hostnamectl set-hostname NEW_HOSTNAMEEdit the file manually:
sudo nano /etc/hostnameReplace the existing hostname with NEW_HOSTNAME, then save (CTRL + X, then Y, then ENTER).
Edit the /etc/hosts file:
sudo nano /etc/hostsReplace any instances of the old hostname with NEW_HOSTNAME. Ensure the file contains:
127.0.0.1 localhost
127.0.1.1 NEW_HOSTNAME
Save and exit.
After completing these steps, the system will use the new hostname upon reboot.