/ How To Change Computer or Host Name In Ubuntu
How To Change Computer or Host Name In Ubuntu
With time changing you may want to change computer or host name of your ubuntu machine… There may be several reasons like you don’t like the current hostname or you mistakenly given other name etc.., So in this post will show you some easy way to change computer or host name of ubuntu.
To change the computer name, just follow the steps below and you will be fine with the change.
Ok, first things first, backup your host files before changing the host name. Though this is optional, it’s a good idea to make a backup copy because, we can restore them if we do some thing wrong. To do the backup, open your terminal by pressing CTRL + ALT + T and use the commands below…
sudo cp /etc/hosts /etc/hosts.old
sudo cp /etc/hostname /etc/hostname.old
After backing-up, enter the below command to open the hosts file…
sudo gedit /etc/hosts
Enter the command as shown above
This will open the hosts file, here enter your favorite name as shown in the image below and hit the save button. Do remember this name as we need to enter the same exact name one more time in another host file.
Change your host name
Now again open your terminal again and enter the below command to open hostname file.
sudo gedit /etc/hostname
Enter the command as show above
Here enter the same name you entered before and hit the save button and close the file.
To view the changes just logout and login(otherwise you may face some problems with some applications). So what are you waiting for, we’ve finished changing your computer or host name.