Why are files duplicated in my home folder and desktop? [duplicate]

Files in my SSD get duplicated on my Desktop. When I delete any folder/file it gets automatically deleted from the second location (Home) and when I create a folder in any of the locations it gets created in both places.

Take this screenshot for reference:

screenshot showing the desktop and the home folder with the same files

I am running Ubuntu 19.04 LTS.


Your user-dirs.dirs folder is messed up, but it's easy to fix it. Open the terminal and run:

nano ~/.config/user-dirs.dirs

If you don't want to use nano you can use your favorite text editor, e.g. gedit.

In user-dirs.dirs you should have some entries similar to the following:

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"

I suppose that in your case your XDG_DESKTOP_DIR entry is just XDG_DESKTOP_DIR="$HOME/". This means that it points to your home directory and that's why you have your home directory "duplicated" on your Desktop. Probably the rest of the entries are messed up too.

Change this entry, along with the rest of them, so they point to the correct locations, as shown above. Save the file and restart your computer for the changes to take effect.

Edit

You have to create the Desktop directory first, since you don't have one. To create it run:

mkdir ~/Desktop