1. Open a terminal window.
2. At the input prompt you will see this structure:
3. So you have to edit the hostname file:
sudo nano /etc/hostname
4. When prompted, enter the administrator password and hit Enter.
5. The hostname file will open, showing the current computer name. Replace the name with the desired new name.
6. Hit Ctrl+X to save and exit.
7. New name will show when you open a new terminal window.