How To Change Your Linux Hostname
You may want to change the name of your Linux box system from time to time. This should work on most, if not all Linux distributions.
Gain root access either through the sudo command or frontend of sudo, (e.g kdesudo, gksudo). You will need to run a text editor (console or desktop based).
Edit /etc/hostname and replace it with a new hostname. Save the file.
Run “hostname -F /etc/hostname” (without quotes) to change the hostname (this command may vary depending on the distribution you are using).
Restart your computer if you do not see the effect, it will not be changed immediately in bash shells.
Do not stay logged in as root for long durations.
When editing system files with root, you must be careful. One wrong thing could put your system in danger!