Linux command
xdg-user-dirs-update 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Change
xdg-user-dirs-update --set DESKTOP "/[path/to/directory]"
Set
xdg-user-dirs-update --set DOWNLOAD "/[path/to/downloads]"
Write
xdg-user-dirs-update --dummy-output "[path/to/dry_run_file]" --set [xdg_user_directory] "/[path/to/directory]"
Force
xdg-user-dirs-update --force
说明
xdg-user-dirs-update updates the current state of the user's user-dirs.dirs file. If none existed before, one is created based on system default values. XDG user directories are special folders like Desktop, Documents, Downloads, Music, Pictures, and Videos. The configuration is stored in ~/.config/user-dirs.dirs and defines where applications should look for user content directories. A user-dirs.locale file is also created on first run to track which locale was used for directory name translations. This command is normally run automatically at the start of a user session. Directories pointing to non-existent locations are reset to the user's home directory.
参数
- --set _NAME_ _PATH_
- Set a specific user directory. NAME must be one of DESKTOP, DOWNLOAD, TEMPLATES, PUBLICSHARE, DOCUMENTS, MUSIC, PICTURES, or VIDEOS. PATH must be absolute.
- --dummy-output _PATH_
- Write the configuration to PATH instead of the default configuration file. No directories are created when using this option.
- --force
- Force a complete reset of existing configuration. Recreates directories instead of resetting to HOME and always recreates the locale file.
- --help
- Print help output and exit.
FAQ
What is the xdg-user-dirs-update command used for?
xdg-user-dirs-update updates the current state of the user's user-dirs.dirs file. If none existed before, one is created based on system default values. XDG user directories are special folders like Desktop, Documents, Downloads, Music, Pictures, and Videos. The configuration is stored in ~/.config/user-dirs.dirs and defines where applications should look for user content directories. A user-dirs.locale file is also created on first run to track which locale was used for directory name translations. This command is normally run automatically at the start of a user session. Directories pointing to non-existent locations are reset to the user's home directory.
How do I run a basic xdg-user-dirs-update example?
Run `xdg-user-dirs-update --set DESKTOP "/[path/to/directory]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --set _NAME_ _PATH_ do in xdg-user-dirs-update?
Set a specific user directory. NAME must be one of DESKTOP, DOWNLOAD, TEMPLATES, PUBLICSHARE, DOCUMENTS, MUSIC, PICTURES, or VIDEOS. PATH must be absolute.