3.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