How to Change Hostname on Ubuntu 20.04
A hostname is a unique identifier of a system on a network, used for management and communication between machines.
How to Change Hostname on Ubuntu 20.04
A hostname is a unique identifier of a system on a network, used for management and communication between machines.

Ubuntu 20.04 supports both temporary and permanent hostname changes via CLI or GUI.
Check Current Hostname
hostname
hostnamectl
hostnamectl provides detailed system info including static, transient, and pretty hostnames.
Temporary Change (until reboot)
sudo hostname new-hostname
- applies instantly
- resets after reboot
Permanent Change (no reboot)
sudo hostnamectl set-hostname new-hostname
- applied immediately
- no reboot required
Permanent Change (with config files)
Edit:
sudo nano /etc/hostname
sudo nano /etc/hosts
Replace old hostname → new hostname.
Apply:
sudo systemctl reboot
Required for full system-level consistency.
Cloud Systems (Cloud-init)
Ensure persistence:
sudo nano /etc/cloud/cloud.cfg
Set:
preserve_hostname: true
Prevents hostname reset after reboot.
GUI Method
- Settings → About
- Change Device Name
Restrictions
- 1–63 characters
- alphanumeric + hyphens
- cannot start/end with hyphen
Summary
- temporary →
hostname - permanent →
hostnamectl - config files →
/etc/hostname,/etc/hosts - cloud → update
cloud.cfg
Full guide 👉https://vsys.host/how-to/change-hostname-on-ubuntu-20-04
메타데이터
- post_id
- d0a554c3c3ad
- slug
- how-to-change-hostname-on-ubuntu-20-04-d0a554c3c3ad
- url
- https://medium.com/@vsys.host/how-to-change-hostname-on-ubuntu-20-04-d0a554c3c3ad
- canonical_url
- https://medium.com/@vsys.host/how-to-change-hostname-on-ubuntu-20-04-d0a554c3c3ad
- author_url
- https://medium.com/@vsys.host
- status
- ok
- fetched_at
- 2026-06-21 22:26:41