Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

6.4. Configuring Host Names Using nmcli

The NetworkManager tool nmcli can be used to query and set the static host name in the /etc/hostname file.
To query the static host name, issue the following command:
~]$ nmcli general hostname
To set the static host name to my-server, issue the following command as root:
~]# nmcli general hostname my-server