You might want to change your computer name (hostname) in Ubuntu, because you need to meet a naming scheme or some specific reason, Let'S try the following steps to change it.

1. Open a terminal window.
2. Input the following command and hit Enter:
sudo nano /etc/hostname
Don't forget to type 'sudo' in command, if not you will face the "permission denied" alert when save the hostname file like the image in step 4 3. When prompted, enter the administrator password and click the OK button.

4. The hostname file will open, displaying the current computer name. Replace the current computer name with the desired new name.

5. Save, Close all open windows and restart your system. After your system has restarted, it will have the new computer name.