1. change hostname – good till nex reboot
#hostname [your_new_hostname]
2. change hostname – good after next reboot
edit /etc/sysconfig/network (RedHat)
3. change ip associated hostname – good till nex reboot
edit /etc/hosts
By finish the combination of 1, 2 and 3 steps you will change your hostname immediatly and permanently.