Ubuntu Linux Change Hostname (computer name)

Originally published at: https://www.cyberciti.biz/faq/ubuntu-change-hostname-command/

I am a new Ubuntu Linux laptop user. I setup my computer name to ‘tom’ during installation but now I would like to change the computer name to ‘jerry’. Can you tell me how do I I remove tom and set it to jerry on Ubuntu Linux? How do I change the Ubuntu computer name from ‘ubuntu’ to ‘AvlinStar’? Can you tell me more about Ubuntu Linux change hostname command?

Use can use the below commands:
Sudo hostname (new hostname)
or switch to root by using below command:
su -
(root Password)