How to Stop Ubuntu from Automatically Recreating the Desktop Folder in Home

Ubuntu Linux adheres to the XDG Base Directory specification, which dictates that every user should have a standard set of folders in their Home directory, including Desktop, Documents, Downloads, Music, Pictures, and Videos. If you are a terminal-focused power user or someone who despises storing files on the desktop, you might prefer to delete the ~/Desktop folder entirely to keep your Home directory clean.

However, if you simply use the rm -rf Desktop command, you will discover that the folder magically reappears the very next time you log in or reboot your computer. This happens because a background utility called xdg-user-dirs-update automatically runs on startup, actively scanning your Home directory and aggressively recreating any “missing” standard folders.

To permanently banish the Desktop folder (or any other standard XDG folder like Public or Templates), you must edit the XDG configuration file and redirect the path to your main Home directory.

How to Stop Ubuntu from Recreating the Desktop Folder

You must instruct the XDG utility that your “Desktop” is now synonymous with your root Home directory.

  1. Open your terminal application (Ctrl+Alt+T).
  2. First, safely delete the existing Desktop folder (ensure it is empty first!):
    rm -rf ~/Desktop
  3. Next, open the XDG user directories configuration file in a text editor (like nano):
    nano ~/.config/user-dirs.dirs
  4. Locate the line that defines the Desktop folder, which usually looks like this:
    XDG_DESKTOP_DIR="$HOME/Desktop"
  5. Modify that specific line to point directly to your root Home directory instead:
    XDG_DESKTOP_DIR="$HOME/"
  6. Press Ctrl+O then Enter to save the file, and Ctrl+X to exit nano.
  7. Finally, prevent the system from overwriting your custom configuration by locking the file:
    echo "enabled=False" > ~/.config/user-dirs.conf

The xdg-user-dirs-update utility will now accept that your Home directory is your Desktop directory. It will immediately stop trying to regenerate the redundant ~/Desktop folder, leaving your file system exactly as clean as you desire.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.