When we open the terminal in the Ubuntu operating system, we will see how the data representing the computer or user name that appears is changed. The place we draw as “omer” indicates the user name. The place we draw as “omer-machine” indicates the name of the computer.
What is the Hostname in Linux?
The hostname is the name assigned to a computer on the network. The hostname is basically just your computer’s name. It is used to identify your computer on the network. You can see your computer name in the terminal using the hostname command. In the screenshot below, the hostname is “omer-machine” while the user name is “omer“.
Changing the Computer Name
First, type the computer name you want by entering the command below and click the “Save” button to save it.
sudo gedit /etc/hostname
Second, edit the /etc/hosts file similarly and replace all instances of your old hostname with the new hostname.
sudo gedit /etc/hosts
Finally, turn the computer off and on after making the changes. You will see that the computer name has changed.
Changing Username
You type the “su username” command to change the user.
root@ubuntu:~# su omer