how to change hostname in centos using command line

Hello,

Sometime we need to change server hostname , It can be possible to change host name by using SSH command line ;

1st we can check the current hostname by command :

hostname

outputs example : server1.bipul.me

Now , we change the hostname by editing network and hosts files . we can edit file by using nano or vi command ;

nano /etc/sysconfig/network

look in outputs and find  HOSTNAME value & change with new hostname ;
for example : HOSTNAME=”server2.bipul.me”
Save and close the file. (more…)

Continue Readinghow to change hostname in centos using command line