Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

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.

share|improve this question

marked as duplicate by Braiam, Jakuje, Stephen Kitt, garethTheRed, Rui F Ribeiro Mar 14 at 18:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 2 down vote accepted

From this answer : How to change the hostname of a linux machine using terminal?

Have you tried running the command :

hostname new_hostname

where "new_hostname" would be value you are trying to set ?

share|improve this answer
    
it works but will it be permanent there? How about the other steps with regards to /etc/sysconfig/network and /etc/hosts? Must I still edit those ? – biz14 Jul 27 '13 at 16:49
    
Yes, you should edit those files too. The two files are for the "permanent" changes, the "hostname" command is for "on the fly" change. – Louis Carrese Jul 28 '13 at 9:50
    
ok let me test I am not too sure about the /etc/hosts how where and what to change exactly can you please verify as some said just put beside the 127.0.0.1 hostname is this correct? – biz14 Jul 28 '13 at 15:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.