Linux – desktop is mirroring home folder and deleting folders removes them permanently, how to restore? (ubuntu)

linuxUbuntu

I tried to make a shortcut (like Windows) to the downloads folder on my desktop, and later realized it caused the actual downloads folder to move, causing issues. In trying to fix them, I ended up with my home folder "home/cchilder/…" on my desktop. When I open Desktop, I see the stuff my desktop actually had before the issue. Of course I don't want to delete my entire computer, so I can't drag and remove all of this and do a simple restore.

When I delete something in home (~) or on the desktop, the operations mirror each other, and deleting a file from the shell deletes it from the desktop too.

I want to know

  1. How could this possibly happen, and why?

  2. How to restore only the real desktop contents (Desktop folder) and untie the desktop I see from the home folder

Thank you

enter image description here

cchilders@cody_pc:~/Desktop$ ls -sFl
total 100
 4 -rwxr-xr-x 1 cchilders cchilders  271 Jul 18 00:32 atom.desktop*
 8 -rw-rw-r-- 1 cchilders cchilders 4552 Aug 29 01:25 Attributes.docx
 4 drwxrwxr-x 2 cchilders cchilders 4096 Sep 17 01:04 books/
 4 -rw-rw-r-- 1 cchilders cchilders  222 Apr 11 21:05 cook rice 4-11-15~
 4 -rw-rw-r-- 1 cchilders cchilders  195 Aug 28 01:37 DEMO~
 4 -rw-rw-r-- 1 cchilders cchilders  201 Aug 28 04:11 demos~
 4 drwxrwxr-x 4 cchilders cchilders 4096 Jun  4 18:56 django texts/
 4 drwx------ 3 cchilders cchilders 4096 Sep 17 14:13 Downloads/
 4 -rwxr-xr-x 1 cchilders cchilders  791 Apr  4 12:52 gedit.desktop*
 4 -rw-rw-r-- 1 cchilders cchilders 1668 Apr 15 20:00 git-workflow-readme.md
 4 -rw-rw-r-- 1 cchilders cchilders 1662 Apr 15 19:51 git-workflow-readme.md~
 8 -rwxr-xr-x 1 cchilders cchilders 4484 Apr 26 10:46 gnome-terminal.desktop*
12 -rwxr-xr-x 1 cchilders cchilders 8469 Mar 29 01:08 google-chrome.desktop*
 4 drwxrwxr-x 2 cchilders cchilders 4096 Jun 16 18:01 hcc/
 4 drwxrwxr-x 3 cchilders cchilders 4096 Apr 12 18:33 Lynda/
 4 -rwxr-xr-x 1 cchilders cchilders  712 Mar 29 20:21 nautilus.desktop*
 4 drwxrwxr-x 2 cchilders cchilders 4096 Jul 27 20:18 pics backup/
 8 -rw-rw-r-- 1 cchilders cchilders 4223 Jun 28 19:03 quiz
 8 -rw-rw-r-- 1 cchilders cchilders 4223 Jun 28 16:51 quiz~

Best Answer

It seems somehow the XDG_DESKTOP_DIR is pointing to your $HOME directory. If that is the case then it should be pointing to $HOME/Desktop

To change this navigate to the .config directory. Ctrl+h shows hidden files/directories in the file manager.

Look for a file called user-dirs.dirs, this is the file you will be editing.

From this file you can set the default directories for various things like Downloads, Documents, Video, etc.

look for the line XDG_DESKTOP_DIR and set it to:

XDG_DESKTOP_DIR="$HOME/Desktop"

Save, exit and restart the file manager and possibly your machine.