ifacethoughts

Changing User’s Default Directory Names In Linux

I prefer all directory and file names in small case. But nowadays most of the Linux distributions start user directories names with a capital letter, like Music or Documents or Downloads. But like many other customizations in Linux, you can configure them to be what you want without brute force. It is xdg-user-dirs.

You will find user-dirs.dirs under $XDG_CONFIG_HOME, which is usually .config, in your home directory. My /home/anadgouda/.config/user-dirs.dirs goes this way:

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
# 
XDG_DESKTOP_DIR="$HOME/desktop"
XDG_DOWNLOAD_DIR="$HOME/downloads"
XDG_TEMPLATES_DIR="$HOME/"
XDG_PUBLICSHARE_DIR="$HOME/public"
XDG_DOCUMENTS_DIR="$HOME/"
XDG_MUSIC_DIR="$HOME/music"
XDG_PICTURES_DIR="$HOME/pictures"
XDG_VIDEOS_DIR="$HOME/videos"

You can change the values of these variables and it will start using those directories. You will notice that I have changed all directory values to small-case.

You can use this as you want, e.g., you can point XDG_MUSIC_DIR or XDG_PICTURES_DIR to a network-mounted location.

There are some utilities that you can use to retrieve and change these values, like xdg-user-dir and xdg-user-dirs-update. But I found it easier to just change the configuration file.

If you are developing an application that needs these directories, instead of assuming their names it is better to read them from the configuration, which is in an easy shell format, or use the binaries to get the data.

Discussion [Participate or Link]

  1. Amit said:

    This will be really useful for me. LDAP type utility at client side will definately help… Thanks.

  2. hybrid Bicycle said:

    hybrid Bicycle

    Changing User’s Default Directory Names In Linux | iface thoughts

Say your thought!

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.

freshthoughts

contactme

Abhijit Nadgouda
iface Consulting
India
+91 9819820312
My bookmarks

badgesand...

This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.