Setting hostname on CentOS 7 KVM based VPS

How do I see the Host names?

hostnamectl
## OR ##
hostnamectl status

How do I set the Host name?

The syntax is:

hostnamectl set-hostname YourHostname --static

To set Hostname as "myvps",enter:

hostnamectl set-hostname myvps --static

To verify new settings, enter:

hostnamectl status

How do I delete a particular hostname?

The syntax is:

hostnamectl set-hostname "" --static

Last modified: October 09 2017 05:12:05