Changing the hostname on Ubuntu 22.04 or 20.04 is explained in a tutorial by Linux Capable.
How to Change Hostname on Ubuntu 22.04 or 20.04
Learn how to quickly change the hostname on Ubuntu 22.04 or 20.04 with the hostnamectl command or by editing the /etc/hostname file. Easy guide for beginners.
How to Change Hostname on Ubuntu 22.04 or 20.04 - LinuxCapable