/etc/hostname to read the hostname of the computer at boot time and sets it up using the init script /etc/init.d/hostname.sh. We can edit the file, change the hostname and then run the script to change it for the current session (or just reboot).Steps (to be performed as root):
nano /etc/hostnamenano /etc/hosts and again change the hostnameservice hostname restart