编程知识 cdmana.com

How to get the correct Linux user's documents, music videos and other directories?

   It's strange for someone to see the title , Isn't this located in the user directory ? For example, there is a music directory under the directory , Are you sure it's the user's directory ? Not created later ? What to do with that ?

   In the user directory , see file .config/user-dirs.dirs 

# .config/user-dirs.dirs 

XDG_DESKTOP_DIR="$HOME/ desktop "
XDG_DOWNLOAD_DIR="$HOME/ download "
XDG_TEMPLATES_DIR="$HOME/ Templates "
XDG_PUBLICSHARE_DIR="$HOME/ Public "
XDG_DOCUMENTS_DIR="$HOME/ file "
XDG_MUSIC_DIR="$HOME/ music "
XDG_PICTURES_DIR="$HOME/ picture "
XDG_VIDEOS_DIR="$HOME/ video "

How to get these variables ? There are two ways :

  • Read the file , Do it yourself .
  • source .config/user-dirs.dirs, Then you have these variables .

版权声明
本文为[Liu Kunpeng]所创,转载请带上原文链接,感谢
https://cdmana.com/2021/11/20211109090526654T.html

Scroll to Top