Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to change a username. In the prompt, which says abhishek@hello$, I want to replace abhishek with alok (i.e. alok@hello$). Is it possible to do that without reinstalling Ubuntu?

share|improve this question
2  
See also this question. –  jw013 Nov 23 '12 at 15:43

1 Answer 1

You can change your username and move all files in your current home directory to your new home directory using

usermod -l alok -md /home/alok abhishek

Got the answer from another reply: http://unix.stackexchange.com/a/40611/26851

share|improve this answer
    
Hi fotomonster, thanks for the reply. Is there any way to change the current home directory name? –  abhishek kumar gupta Nov 23 '12 at 13:16
    
The -md /home/alok part should have moved your old homedirectory already. –  fotomonster Nov 23 '12 at 13:20
    
Just saw that there was a typo in the usermod line, so you home directory possibly hasn't been moved. Issuing usermod -md /home/alok alok should move the files in your home directory. –  fotomonster Nov 23 '12 at 13:24
    
Hi fotomonster, thanks for your suggestion. I have tried but terminal displays the following message - usermod: user 'alok' does not exist. Is there a need to create first "alok" home directory or "alok" user account? if yes, can you suggest how to create it. –  abhishek kumar gupta Nov 23 '12 at 14:53
    
You need to modify the existing username first #usermod -l login-name old-name –  midnightsteel Nov 23 '12 at 15:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.