How to change the hostname on Ubuntu

Ubuntu 20.04 is a Linux-based operating system that was released on April 23, 2020. It’s a better version of Ubuntu 19.10. Since each operating system is supported by LTS for 5 years, Ubuntu is also supported for an additional 5 years. It was published first on Launchpad and then on Ubuntu’s Wiki. It has fast boot time and many other features. It has different variations of design and different background images that you can apply. This article provides all the information about how to change the host name on the latest Ubuntu operating system. It performs amazing functions and many advantages. Some of them include:

  • Redesigned login screen
  • New wallpaper
  • Performance improvements
  • Do not disturb mode
  • Fractional scaling
  • New kernel
  • The Amazon app is excluded as the main app

You can change your hostname on Ubuntu by reading the instructions below.

Step 1:

First of all, you need to check your current hostname. To check this, you need to enter the hostnamectl or hostname command:

$ Hostname

The output from the hostnmectl command might look like the one shown above.

$ hostnamectl

No matter in which case the host name of the operating system is Ubuntu.

Step 2:

Now you can easily change your current host name by simply typing the name of your choice in e.g. younisx or any other host name you would like by using the terminal emulator command below.

$ sudo hostnamectl set-hostname younisx

The command just mentioned changes the hostname of our Ubuntu system to younisx. The following file should be edited to change the Ubuntu host name.

/Etc/Hostname

Step 3:

You have to edit the host name there and you can then easily change your old username to the new one. Then you need to check that the new hostname is also present in the file given below:

$ cat /Etc/Hostname

Note: If you change your hostname using the hostnamectl command, no system reboot is required during the process.

Step 4:

After that we need to edit the / etc / hosts file to make changes by entering the following command:

$ sudo to edit /Etc/Host.

Apply the hostnamectl command so that you can confirm your hostname change to ensure that the changes are reflected in the system.

Diploma:

You can easily change your hostname by following the above steps one by one. It will help you log into Ubuntu with the changed hostname. This will help you have a better experience with Ubuntu and make changes as you wish. Remember to follow the exact steps for better, faster results. At the end, you can restart the computer to see if your hostname has changed or not. Have fun enjoying the benefits of Ubuntu.

Related Posts