Easy Steps To Change Hostname on Ubuntu 22.04

In this guide, we want to teach you to Change Hostname on Ubuntu 22.04. hostname is used to either set or display the system’s current host or domain name. Many networking programs use this name to identify the machine, and NIS/YP also uses it.

By default, a system’s hostname is set during the OS installation. Even if we install a virtual machine, the system dynamically assigns it. However, there may be some conditions whenever we want to change the hostname. The hostname command will let us do so. Follow the guide steps below on the Orcacore website to Change Hostname on Ubuntu 22.04.

Steps To Change Hostname on Ubuntu 22.04

To complete this guide, log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with Ubuntu 22.04.

In this guide, we will show you how to change your Ubuntu hostname by using the following methods:

  • change hostname using the command line
  • change hostname using GUI

1. Ubuntu 22.04: Change Hostname via Command Line

First, you need to check your current hostname on your server by using the following command:

sudo hostname
Output
ubuntulinux

In my case, it is ubuntulinux.

At this point, you can use the following syntax to change your hostname:

sudo hostname your-hostname

For example:

sudo hostname jammy.jelly

Again check your hostname, you should see that it has been changed.

sudo hostname
Output
jammy.jelly

2. Ubuntu 22.04: Change Hostname via GUI

From your Ubuntu desktop, click on the top right corner where the battery icon, sound icon, and internet icon are displayed. A drop-down menu will pop up. In that menu click on the settings options.

Change hostname ubuntu 22
Change hostname ubuntu 22

From the settings menu, click on About from the first section, and click on Device Name.

Then, a message box will open up displaying your previous hostname. Erase that name and insert your new desired hostname and press “Rename”. 

Rename Ubuntu Device
Rename Device

That’s it, you are done.

Conclusion

At this point, you have learned to Change Hostname on Ubuntu 22.04. You can easily use the command line interface or from your desktop settings, you can change your hostname.

Hope you enjoy it. Please subscribe to us on Facebook, Twitter, and YouTube.

You may also like these articles:

Install and Use Sysdig on Ubuntu 22.04

How To Install OpenSSL 3 on Ubuntu 20.04

Share your love

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!