+
+
prettier
notepad++
choo
+
+
+
=>
+
quarkus
supabase
terraform
+
yaml
deno
actix
+
qdrant
intellij
tls
qwik
+
ionic
preact
groovy
+
windows
+
+
redhat
+
+
!!
vscode
html
packer
+
+
+
+
bun
+
marko
grafana
supabase
+
+
ray
+
laravel
+
+
+
choo
netlify
pip
sinatra
f#
aurelia
gitlab
+
graphdb
+
+
+
+
yaml
+
junit
rocket
packer
+
hugging
+
--
+
dynamo
cypress
+
+
redhat
rs
lit
+
//
ts
clion
+
Back to Blog
How to Change Hostname on Ubuntu 22.04
Linux Ubuntu

How to Change Hostname on Ubuntu 22.04

Published Mar 9, 2024

Learn to change your Ubuntu 22.04 system's hostname, a unique identifier, through this guide. Explore temporary and permanent methods like commands and config files.

2 min read
0 views
Table of Contents

Introduction

The hostname is a unique name assigned to a computer or device connected to a network. It serves as an identifier and facilitates communication with other devices on the same network.

Prerequisites

Ensure you have sudo privileges or are logged in as the root user.

Changing the Hostname Temporarily

  1. Check current hostname:
hostname
  1. Change hostname temporarily:
sudo hostname new-hostname

Changing the Hostname Permanently

  1. Edit /etc/hostname:
sudo nano /etc/hostname
  1. Edit /etc/hosts:
sudo nano /etc/hosts
  1. Reboot system:
sudo reboot

Using Hostnamectl Command

  1. Change static hostname:
sudo hostnamectl set-hostname new-hostname
  1. Change transient hostname:
sudo hostnamectl set-hostname --pretty new-hostname

Conclusion

Changing the hostname on Ubuntu 22.04 can be done through multiple methods, providing flexibility for system management.