To change the hostname, the hostname is located in the following configuration file
The file contains three lines. We are only interested in changing the third linux beginning with hostname as this is the hostname. You can add whatever suits your fancy after the equals symbol.
Then you need to restart the networking process, via the following command
Now you can restart the network services that control the hostname at startup. Manually starting the above command should show you the results below.
Now your hostname should be changed. You can check your hostname with the hostname command
Under ubuntu to change the hostname as of this writing using ubuntu version 10.04.03 you need to modify the following file
There will be one line with the name of the machine. Just change the name from what exists to the new name you want the machine to be called. There is a issue I have with ubuntu 10.04.03. It seems that the init script to restart the hostname does not work, nor the hostname service. The only way I have been able to get around this is to reboot the machine. This may be fixed in versions afterwards.