Change hostname from localhost.localdomain to something else

When I use the command hostname, it shows “localhost.localdomain”. How may I change it to something else, such as MyComputer?

Hi
Use the hosnamectl command as root user…


 hostnamectl 
   Static hostname: k3s-node1

hostnamectl set-hostname MyComputer

hostnamectl
   Static hostname: MyComputer

Thank you so much! That worked.