Thanks sammydee. But there is an easier, safer and faster way to do this.
Using Ubuntu 8.04 LTS (Desktop edition).
* Navigate to System > Administration > Network
* Select the General tab.
* You might have to click on Unlock button.
* Enter the new name of your computer in the Host name field.
* Click Close button.
* Close all open applications and reboot.
This will automatically change all settings related to hostname (computer name). Including /etc/hosts and /etc/hostname