We have centos machine. We have tried both the /etc/hosts and also /etc/sysconfig/network. Edited both files and service network restart. Yet the hostname is showing as localhost.localdomain. How to resolve on this? Googling almost all talking about the same method too.
From this answer : How to change the hostname of a linux machine using terminal?
Have you tried running the command :
where "new_hostname" would be value you are trying to set ?