In this post I'll show you how to rename you user account with example on Ubuntu Linux operating system. I did this the other day because I didn't like user name i gave to the Ubuntu installer, so i wanted to rename my account together with my home folder and all that goes with doing so...
First i have created temporary user account and joined it to the admin group. You can't mess with users account while being logged in to it (enabling root account on Ubuntu looked too messy). This is how to create user (remember the password you gave to adduser cause you'll need it to log in to your temp account):
sudo adduser temp sudo adduser temp admin
Now we shall logout and log in as temp user but not using GUI way, instead we will use virtual terminal to do our magic. You should grab pen and paper (photographic memory should help also) to write down this procedure cause there is no GUI where we are headed.
Now restart your PC and when prompted for login press Ctrl+Alt+F1. On the virtual console tty1 log in with you temp user name and password you have provided to adduser command. Now enter these lines one by one replacing "oldname" and "newname" with what you have now and what you want to have after this is over.
sudo usermod -l newname -d /home/newname -m oldname sudo groupmod -n newname oldname sudo chown -R newname:newname /home/newname sudo deluser temp sudo reboot
Some applications hardcode your home path in recent files and stuff like that (by the way that is very bad practice, people should use $HOME variable or something similar instead of hardcoding /home/username). Those hardcoded links wont work anymore because user name has changed. To track down those applications you could run something like following to find files in your home directory that contain old path string.
grep "home/oldname" -R .*
Now update all files with your new home path and be on your way (Gedit : Search -> Replace). On my system only Virtualbox files had to be changed. That is it. Cheers!