How to Change the Hostfile Entry in the Cent OS 7

In Order to change the host file entry in the Centos 7, you may need to login on the console using the root credentials and have to run the below command: 

# hostnamectl set-hostname

Once the above command is executed you may need to restart the network services to ensure the changes made persists in the system.

# /etc/init.d/network restart

Comment below in case of any queries