LinuxCommandLibrary

xdg-user-dirs-update

Update user directory paths

TLDR

Change XDG's DESKTOP directory to the specified directory (must be absolute)

$ xdg-user-dirs-update --set DESKTOP "[path/to/directory]"
copy

Write the result to the specified dry-run-file instead of the user-dirs.dirs file
$ xdg-user-dirs-update --dummy-output "[path/to/dry_run_file]" --set [xdg_user_directory] "[path/to/directory]"
copy

SYNOPSIS

xdg-user-dirs-update [--force]

PARAMETERS

--force
    Forces an update, even if the user directories configuration file (user-dirs.dirs) is up to date. This can be useful for recreating missing directories or applying changes.

DESCRIPTION

xdg-user-dirs-update is a utility that creates and updates common user directories (like Desktop, Documents, Downloads, Music, Pictures, Public, Templates, Videos) in a user's home directory according to the XDG Base Directory Specification.

It reads configuration from ~/.config/user-dirs.dirs and ~/.config/user-dirs.locale to determine the paths and localized names of these directories. If a directory listed in user-dirs.dirs does not exist, xdg-user-dirs-update will create it. It is often run automatically on login or when the locale changes to ensure the user's environment is consistent and standard directories are available. This tool helps various applications and desktop environments find common user files in predictable locations.

CAVEATS

This command typically runs automatically, and users rarely need to invoke it manually unless troubleshooting or forcing a refresh.

The actual directory names and locations are determined by the ~/.config/user-dirs.dirs and ~/.config/user-dirs.locale files. Modifying these files manually can affect the behavior of this command.

It does not move existing files if a directory's location changes; it only creates new directories.

CONFIGURATION FILES

The behavior of xdg-user-dirs-update is primarily controlled by two files in the user's configuration directory:

  • ~/.config/user-dirs.dirs: Defines the paths to the user's standard directories (e.g., XDG_DOWNLOAD_DIR="$HOME/Downloads").
  • ~/.config/user-dirs.locale: Stores the locale used when the user-dirs.dirs file was last updated. If the system locale changes, this tool will attempt to update directory names to match the new locale.

ENVIRONMENT VARIABLES

The paths defined in user-dirs.dirs are often used by applications that respect the XDG Base Directory Specification. While xdg-user-dirs-update creates these directories, applications might also read these paths from the user-dirs.dirs file directly or through helper utilities like xdg-user-dir.

HISTORY

xdg-user-dirs-update is part of the xdg-user-dirs package, developed by Freedesktop.org. This initiative aims to standardize the location of user-specific data files and directories across different desktop environments on Linux and other Unix-like systems, thereby improving interoperability. It has become a common component in modern desktop environments like GNOME and KDE.

SEE ALSO

Copied to clipboard