How to “hostname” on Rhel/Centos 7

To see all hostname types do “hostnamectl” or “hostnamectl status

hostnamectl set-hostname rhel7.olivermel.com
hostnamectl set-hostname rhel7.olivermel.com –pretty
hostnamectl set-hostname rhel7.olivermel.com –static
hostnamectl set-hostname rhel7.olivermel.com –transient

the additional flags/options are to change for pretty, static and transient hostnames

To delete hostname, just set to empty string

hostnamectl set-hostname “”
hostnamectl set-hostname “” –pretty
hostnamectl set-hostname “” –static
hostnamectl set-hostname “” –transient

 

Leave a Reply

Your email address will not be published. Required fields are marked *