Ubuntu – The home directory content deleted

14.04data-recovery

My home folder disappeared all of a sudden (Desktop, Downloads, Documents … all deleted) and now my system considers my Desktop as the home directory. Is there any way to recover my old Desktop, Downloads …

Update:

$ cat ~/.config/user-dirs.dirs

# 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/"
XDG_DOWNLOAD_DIR="$HOME/"
XDG_TEMPLATES_DIR="$HOME/"
XDG_PUBLICSHARE_DIR="$HOME/"
XDG_DOCUMENTS_DIR="$HOME/"
XDG_MUSIC_DIR="$HOME/"
XDG_PICTURES_DIR="$HOME/"
XDG_VIDEOS_DIR="$HOME/"  

Best Answer

To return all to the defaults and recover your Desktop run the following single command in a Terminal window and then reboot:

xdg-user-dirs-update --set DESKTOP "$HOME/Desktop" && \
xdg-user-dirs-update --set DOWNLOAD "$HOME/Downloads" && \
xdg-user-dirs-update --set TEMPLATES "$HOME/Templates" && \
xdg-user-dirs-update --set PUBLICSHARE "$HOME/Public" && \
xdg-user-dirs-update --set DOCUMENTS "$HOME/Documents" && \
xdg-user-dirs-update --set MUSIC "$HOME/Music" && \
xdg-user-dirs-update --set PICTURES "$HOME/Pictures" && \
xdg-user-dirs-update --set VIDEOS "$HOME/Videos"

If you wish to weed out some of these you can do so judiciously by using the xdg-user-dirs-update as detailed above...