You might run into a situation that requires you to change your computer name, either because you need it to meet a naming scheme or you’re just bored with it and want something better. By following these steps, you’ll give your computer a new identity in no time.
Step 1 Open terminal by pressing Ctrl + Alt + T and enter following commands to open the hostname file.
sudo vi /etc/hostname |
Step 2 Enter the desire hostname you want to change to and save it

Step 3 Now open the host file by running following command
sudo vi /etc/hosts |
Step 4 Then change the 2nd line to reflect the new name and save.

Step 5To change your system workgroup name, we need to edit samba smb.conf file. Run following command to open samba configuration file
sudo vi /etc/samba/smb.conf |
Step 6 Find the line shown below and change the workgroup name to whatever you want it to be and save.

Step 7 Close all open windows and restart your system. After your system has restarted, it will have the new computer name and workgroup.
Related content:
