Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone know how I might change my home directory in the shell please?

share|improve this question
up vote 57 down vote accepted


sudo usermod  -d new_home_dir  username

will change your home directory to new_home_dir and will also update the system file that stores the location of your home directory (/etc/passwd).

If you also want to move all files from your current home directory, use:

sudo usermod  -d new_home_dir  -m  username
share|improve this answer
Worked for me in Ubuntu 12.04, thanks – HappyDeveloper Jul 4 '12 at 3:19
After I have done this, only desktop background is shown when I log in. For 13.10 .. even this is an answer from 2009 :) – Aleks May 26 '14 at 22:31
@Aleks the functionality of usermod hasn't changed in years, or probably decades, so this answer should still be valid. As for why you're only seeing your desktop background, perhaps something else in your desktop environment depends on the username, in which case usermod doesn't know about it. But I can only guess at why this is happening (without having access to the system). – David Z May 27 '14 at 0:29
Thanks David. I thought too that this functionality hasn't changed in years so I have tried it. My was a fresh new install of Ubuntu, so , with additional steps, this answer helped me (just like yours, but with additional step - or more precise to create a new fresh new folder, which in my case was enough for me) thanks David – Aleks May 27 '14 at 7:22

this is a nice How-To on home-dir moving. I Have not tried this myself, but it looks rather complicated.


share|improve this answer
It's not as complicated as it looks, they just had to explain in detail for people who aren't familiar with the process. All it really involves is (1) create partition, if necessary (2) mount partition (3) copy files (3) unmount partition (4) edit /etc/fstab (5) move old home directory out of the way (6) move new home directory to /home (7) mount new /home (8) check everything, and remove old home directory – David Z Sep 13 '09 at 12:33

I have not tried this, but I think you can change it in /etc/passwd.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .