How to change or restore ubuntu default home folders
Ubuntu uses a few “default” folders inside users Home directory. These folders also has a special icon on the folder, and they are linked automatically in your file manager sidebar like Nautilus.
The default folders are
When I did an system upgrade a few days ago something went terribly wrong and all my default folders stopped working and also my desktop was showing all folders inside my Home directory. When I tried access the default folder Documents it just gave me an error.
However it’s really easy to restore or change the path of Ubuntu default Home folders. You can do this in a few different ways. Only by terminal or using a text editor.
Using text editor
Open your file manager like nautilus and go to your user Home directory
Show hidden files by pressing Ctrl + H on your keyboard or go in to the upper right menu and check “Show hidden files”.
Now open the folder .config and at the bottom you should find a file named user-dirs.dirs
Open this file in your preferred text editor
Here you can see what the paths are for each default folder in your Home directory. If you want to make sure that you use the default paths for Ubuntu then you can copy this text and replace your existing one with it.
# This file is written by xdg-user-dirs-update # If you want to change or add directories, just edit the line you're # interested in. All local changes will be retained on the next run. # Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped # homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an # absolute path. No other format is supported. # XDG_DESKTOP_DIR="$HOME/Desktop" XDG_DOWNLOAD_DIR="$HOME/Downloads" XDG_TEMPLATES_DIR="$HOME/Templates" XDG_PUBLICSHARE_DIR="$HOME/Public" XDG_DOCUMENTS_DIR="$HOME/Documents" XDG_MUSIC_DIR="$HOME/Music" XDG_PICTURES_DIR="$HOME/Pictures" XDG_VIDEOS_DIR="$HOME/Videos"
When you done editing the file just save it and close the editor. To activate your changes keep reading.
You can also change the path to default Home folders with the terminal and some simple commands if you don’t like using GUI.
To show current path to a folder run following command
xdg-user-dir DESKTOP xdg-user-dir DOCUMENTS xdg-user-dir MUSIC
etc. To see a complete list run the command
in your terminal
To change the path to a folder run following command
xdg-user-dirs-update --set XDG_VIDEOS_DIR="/path/to/videosfolder"
To change all paths to Ubuntu default run following commands one by one
xdg-user-dirs-update --set XDG_DESKTOP_DIR="$HOME/Desktop" xdg-user-dirs-update --set XDG_DOWNLOAD_DIR="$HOME/Downloads" xdg-user-dirs-update --set XDG_TEMPLATES_DIR="$HOME/Templates" xdg-user-dirs-update --set XDG_PUBLICSHARE_DIR="$HOME/Public" xdg-user-dirs-update --set XDG_DOCUMENTS_DIR="$HOME/Documents" xdg-user-dirs-update --set XDG_MUSIC_DIR="$HOME/Music" xdg-user-dirs-update --set XDG_PICTURES_DIR="$HOME/Pictures" xdg-user-dirs-update --set XDG_VIDEOS_DIR="$HOME/Videos"
How to activate your changes
When you are done editing the paths you can activate the changes by either
- Logout your user.
- Reboot your computer.
Or run this command in your terminal
You should now see and be able to access your folders in nautilus sidebar.
You don’t need to specify the paths to directory’s inside your Home folder. You can if you want to, change the paths to a folder on a different hard drive or location on your system. However you need to be sure that you always has access to those locations otherwise the link will be broken and not work of course.Ubuntu uses a few “default” folders inside users Home directory. These folders also has a special icon on the folder, and they are linked automatically in your nautilus sidebar.