I installed openbox and been using it from past 2 months and playing with terminal too much. I don't know what happened now all my files and folders are reflecting on my Desktop.

How can I change this? How did this happen (if possible)

Thanks in advance.


Just for the sake of exemplification, let's assume that your username is abhishek and that your home folder is /home/abhishek, ok? Just change it for the correct info, at my examples below.

Open a shell terminal window and issue the command below, in order to check what's the parameter currently attributed to your $HOME environment variable:

echo $HOME

If the output is not /home/abhishek, then run the command below in order to set the new value of $HOME:


...and then run:

export HOME

...in order to make this change take effect.

Afterwards, run the usermod command just to make sure that the Linux system "knows" that your home folder is in fact /home/abhishek. Here's the full command:

sudo usermod --home /home/abhishek abhishek

Now... Do you have GNOME Edit (aka GEdit or gedit) installed? If not, first install it:

sudo apt-get install gedit -y

...then use GEdit to take a look at your user-dirs.dirs file:

gedit /home/abhishek/.config/user-dirs.dirs

...and fix everything. E.g.: the XDG_DOWNLOAD_DIR attribute should look like XDG_DOWNLOAD_DIR="$HOME/Downloads", where "$HOME/Downloads" is the correct parameter and the value of the variable $HOME must be /home/abhishek (your theoretical home folder).

After fixing the code, save the file and close/exit GEdit.

In case you're unable to use the GUI (graphical user interface) because your login / account isn't being identified anymore by the display manager, press Ctrl Alt F1 to switch to the TTYS1 (terminal 1) login prompt (it's in text mode), then log into your account (Linux shell) and use Nano to edit that file:

nano /home/abhishek/.config/user-dirs.dirs

After you fix everything, use Ctrl O to save the changes and Ctrl X to exit Nano. If you don't have Nano installed, run sudo apt-get install nano -y in order to install it and then use it to edit the file.

After saving the changes made to user-dirs.dirs and closing/exiting GEdit/Nano, run this command in order to restart the operating system:

sudo telinit 6

If my answer didn't help you, take a look at this question and also this other one.

  • Thanks for your help. Desktop folder was deleted and $HOME was assigned as desktop in 'user-dirs.dirs'. I created a Desktop folder, edited the .dirs file and restarted. – Abhishek Mar 11 '17 at 19:14
  • @Abhishek You're welcome. :) – Yuri Sucupira Mar 11 '17 at 20:23

Logout from the account from which you want to change the home directory and login into other user account, if other user account is not present create one. Then type

usermod -d /home/username username

That's it. Your home directory will be changed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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