The default name was set when you were installing Ubuntu. You can easily change it to whatever you want in both Desktop & Server by editing the hosts and hostname files. Below is how:
- Press CtrlAltt on keyboard to open the terminal. When it opens, run the below command:
sudo hostname NEW_NAME_HERE
This will change the hostname until next reboot. The change won’t be visible immediately in your current terminal. Start a new terminal to see the new hostname.
- To change the name permanently, run command to edit the host files:
sudo gedit /etc/hostname and
sudo gedit /etc/hosts
or you can open terminal and press sudo nautilus and enter after that go to computer etc hostname their edit the file as you want then save it
For Ubuntu server without a GUI, run
sudo vi /etc/hostname and
sudo vi /etc/hosts and edit them one by one. In both files, change the name to what you want and save them.
Finally, restart your computer to apply the changes.