To check your current hostname enter the following in the terminal
hostname
Enter the following command to open the hostname file in nano. If you are not logged in as a root user, you will need to add sudo and enter your root password.
sudo nano /etc/hostname
Delete the current hostname and set your new name,
Press CTRL + O , then press enter to save the file
Press CTRL + X to exit nano
Next you need to reboot your machine to confirm the changes
sudo shutdown -r now
Next time your login your new hostname will be applied.