This is a simple note for myself since I've already forgotten how to change my Ubuntu hostname. And yes, seriously i forgot how to modify it already. Sigh~ So i googled it and poof!! This is how it can be done, in less than a minute.

1. Open up a terminal (note that biborn is my username and linuxbox is my current hostname).

2. Type in sudo nano /etc/hostname (you can use other text editor programs such as vi or gedit, I'll just use nano here).

3. The output should looks like this. (this is my current hostname, still unchanged).

4. Now just edit the text there. (I'm replacing "linuxbox" with "tralala").

5. Now just save the changes you've made and close the terminal session and then bring up a new terminal session. You'll see the changes.

6. We're not done yet. You'll face some problem such as message saying "cannot resolve your hostname" everytime you are running sudo command. To fix this, you have to edit the hosts file. Simply run this command 'sudo nano /etc/hosts' and edit the old hostname to match the new one.

My old hostname

My new hostname replacing the old one

And that's it! You're done and good to go.

**Some sources on the internet say that you have to reboot for the changes to take effect but in my case, I don't have to. I don't know why. Maybe because I'm running the latest version of Ubuntu 13.04. Feel free to clarify this.

However, in case if that does happens to you, and you want to avoid the hassle of rebooting your system you can just simply run this command to make the changes take effect immediately.

sudo /etc/init.d/ start