What are the step to move all your dotfiles into XDG directories?











up vote
14
down vote

favorite
10












The XDG Base Directory Specification provide a set of directory one may used to store data that used to go in so called dot files/directory in the user folder. This post aims to help users who desire use this directories as much as possible.










share|improve this question




























    up vote
    14
    down vote

    favorite
    10












    The XDG Base Directory Specification provide a set of directory one may used to store data that used to go in so called dot files/directory in the user folder. This post aims to help users who desire use this directories as much as possible.










    share|improve this question


























      up vote
      14
      down vote

      favorite
      10









      up vote
      14
      down vote

      favorite
      10






      10





      The XDG Base Directory Specification provide a set of directory one may used to store data that used to go in so called dot files/directory in the user folder. This post aims to help users who desire use this directories as much as possible.










      share|improve this question















      The XDG Base Directory Specification provide a set of directory one may used to store data that used to go in so called dot files/directory in the user folder. This post aims to help users who desire use this directories as much as possible.







      xdg






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 7 '15 at 14:00

























      asked Feb 7 '15 at 11:52









      psychoslave

      328212




      328212






















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          13
          down vote













          Indeed, the current short answer to the question is you can't, as some application hardcode the path. Neither the less, many application which doesn't specifically support XDG directories enable to set other directories through environment variables. Some time you need to be able to change the system wide configuration, for example with shell, but most of the time, you should be able perform the step as a unprivileged user.



          Setting you shell



          # Setting bash to use $XDG_CONFIG_HOME/bash 

          ### Moving existing files
          mkdir -p $XDG_CONFIG_HOME/bash
          for file in ~/.bash*;do
          dest=${XDG_CONFIG_HOME}/bash/$(basename $file|cut -d. -f2)
          mv -i "$file" "$dest" # don't overwrite without permission
          done

          ### Sourcing and setting variables
          sudo sh -c 'cat >>/etc/profile.d/bash_in_xdg_config_home.sh <<CONF
          # Make bash follow the XDG_CONFIG_HOME convention
          if [ -d "$XDG_CONFIG_HOME/bash" ] && [ "$0" = "bash" ]
          then
          . "${XDG_CONFIG_HOME}/bash/bash_profile"
          . "${XDG_CONFIG_HOME}/bash/bashrc"
          HISTFILE="${XDG_CONFIG_HOME}/bash/bash_history"
          fi
          CONF
          '

          sudo sh -c 'cat >>/etc/bash.bash_logout <<CONF
          if [ -s "${XDG_CONFIG_HOME}/bash/bash_logout" ]
          then
          . "${XDG_CONFIG_HOME}/bash/bash_logout"
          fi
          CONF
          '

          # Setting zsh
          ## System wide configuration (using xdg directories)
          sudo sh -c 'cat >>/etc/zshenv <<CONF
          if [[ -z "$XDG_CONFIG_HOME" ]]
          then
          export XDG_CONFIG_HOME="$HOME/.config"
          fi

          if [[ -d "$XDG_CONFIG_HOME/zsh" ]]
          then
          export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
          fi
          CONF
          '


          If you use several shell, for example zsh for interactive shell, but an other for scripting, you may want to $XDG_CONFIG_HOME/profile file, that you will source in relevant shell initialization script.



          Setting environment variables



          # bazaar
          export BZRPATH=$XDG_CONFIG_HOME/bazaar
          export BZR_PLUGIN_PATH=$XDG_DATA_HOME/bazaar
          export BZR_HOME=$XDG_CACHE_HOME/bazaar

          # gnupg
          export GNUPGHOME=${XDG_CONFIG_HOME}/gnupg

          # ICEauthority
          export ICEAUTHORITY=${XDG_CACHE_HOME}/ICEauthority

          # less
          export LESSHISTFILE="${XDG_CONFIG_HOME}/less/history"
          export LESSKEY="${XDG_CONFIG_HOME}/less/keys"



          # mplayer
          export MPLAYER_HOME=$XDG_CONFIG_HOME/mplayer

          # subversion
          export SUBVERSION_HOME=$XDG_CONFIG_HOME/subversion


          # vim
          export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'
          export VIMDOTDIR="$XDG_CONFIG_HOME/vim"


          Work around



          SSH



          SSH does provide a way to change the client configuration file, but – as far as I found – only through command line. So one solution to always invoke the clients with a none default emplacement may be :



          if [ -s "${XDG_CONFIG_HOME}/ssh/config" ]
          then
          SSH_CONFIG="-F ${XDG_CONFIG_HOME}/ssh/config"
          fi
          if [ -s "${XDG_CONFIG_HOME}/ssh/id_dsa" ]
          then
          SSH_ID="-i ${XDG_CONFIG_HOME}/ssh/id_dsa"
          fi

          alias ssh="ssh $SSH_CONFIG $SSH_ID "
          alias ssh-copy-id="ssh-copy-id $SSH_ID"


          And your ${XDG_CONFIG_HOME}/ssh/config should contain something like :



          Host *
          IdentityFile /home/user/.config/ssh/id_dsa


          What doesn't work yet



          Although GNUPGHOME is a documented variable, under Fedora 21 you'll end up with the creation of a new ~/.gnupg directory when you launch a new session.



          Although ICEauthority is a documented variable, under Fedora 21 you'll end up with the creation of a new cookie when you launch a new session.



          The dotfile ~/.swt content should probably be stored directly into ${XDG_DATA_HOME}, as both have lib directories. No documentation was found on how to to that if it's possible.



          Mozilla products doesn't support an appropriate environment variable, see Mozilla products doesn't allow to use a custom user configuration directory and Support for the Freedesktop.org XDG Base Directory Specification.



          Other useful sources




          • Move your config files to $XDG_CONFIG_HOME

          • https://github.com/woegjiub/.config/blob/master/bash/xdg.sh


          • http://www.reddit.com/r/linux/comments/2v8rv2/move_your_config_files_to_xdg_config_home/ (Move your config files to $XDG_CONFIG_HOME)

          • https://github.com/grawity/dotfiles/blob/master/.dotfiles.notes






          share|improve this answer



















          • 1




            When using bash as interactive non-login shell (normal terminal usage), shouldn't /etc/profile be not read at all? Won't our definitions be not set then?
            – Hashken
            Apr 10 '15 at 10:29






          • 1




            According to the manpage on my system, you are right. Now what I would suggest you is to simply test, as it may depends on your system default configuration. Please give feed back, thank you.
            – psychoslave
            May 2 '15 at 8:54






          • 1




            I can confirm that /etc/profile is not read for non-login shells. But, if you open tmux your /etc/profile is read. This is because tmux opens all its shells as login shells.
            – Hashken
            May 2 '15 at 9:02






          • 1




            things like history files should be stored under $XDG_CACHE_HOME
            – user187717
            Jul 12 '15 at 11:46










          • 1) Add: export XAUTHORITY="$XDG_CACHE_HOME/Xauthority" 2) Please quote your variables! (see (1) for an example) 3) For my bash, I needed to: export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:="$HOME/.config"}
            – Tom Hale
            Sep 25 '16 at 15:18




















          up vote
          5
          down vote













          I recommend consulting the Arch Linux wiki page XDG Base Directory support which is continuously updated.



          GIT



          I just moved my .gitconfig to XDG_CONFIG_HOME on OSX. Per the git-config documentation (link omitted due to reputation).



          Second user-specific configuration file. If $XDG_CONFIG_HOME is not set or
          empty, $HOME/.config/git/config will be used. Any single-valued variable
          set in this file will be overwritten by whatever is in ~/.gitconfig. It is
          a good idea not to create this file if you sometimes use older versions of
          Git, as support for this file was added fairly recently.


          I set the environment variable using the instructions in Setting the system-wide PATH environment variable in Mavericks. Note that you will need to create the file XDG_CONFIG_HOME/git/config yourself and if ~/.gitconfig exists it will take precedence.



          VIM



          I used Tom Vincent's 2011 article Vim respect XDG and it seems to work. I'm not sure about the above answer; VIMDOTDIR doesn't seem to be a thing.






          share|improve this answer























          • Note: I'm moving to using nixos.org which makes it possible to completely control all configuration in an elegant manner
            – Ben Creasy
            May 8 at 18:48


















          up vote
          0
          down vote













          Zsh does a slightly better job than bash letting you de-clutter your home using the $ZDOTDIR variable. To move zsh out of the way, you need to add the following to your ~/.zshenv file:



          # ~/.zshenv contents
          # this is the bare bones setup to move everything to XDG dir
          ZDOTDIR=$HOME/.config/zsh


          If you have root privledges, you could add this instead to /etc/zsh/zshenv and avoid the need for any zsh dotfiles in your $HOME. From here, all your other zsh dotfiles can be moved to ~/.config/zsh, like .zshrc. I also recommend adding your zsh history to the $XDG_DATA_HOME location: HISTFILE=$XDG_DATA_HOME/zsh/zsh_history.



          Some apps will look for the XDG locations by default and you may not even realize it because you still have a legacy dotfile in your $HOME directory. Git is a good example of this - if you have a ~/.gitconfig, try moving it to ~/.config/git/config. My personal favorite, Fish Shell, uses ~/.config by default too.



          Also, check your other apps for their own version of a re-$HOME-ing variable. Many support it XDG via a variable:




          • Atom: export ATOM_HOME=$XDG_CONFIG_HOME/atom

          • lpass: export LPASS_HOME=$XDG_CONFIG_HOME/lpass

          • rupa/z has one: export _Z_DATA=$XDG_DATA_HOME/z/z.txt


          But there's still quite an extensive XDG wall of shame. Tmux has been actively hostile to supporting de-cluttering your $HOME. Same with pylint. And Julia. And the list goes on. Arch keeps a nice running list of XDG support here.



          Honestly, I can't understand the resistance to supporting it. Users need to clearly send a clear message that apps shouldn't be running roughshod over their $HOME. It's not okay anymore. A modern system uses hundreds of apps that pollute $HOME, not tens like it used to be 20 years ago.






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f874901%2fwhat-are-the-step-to-move-all-your-dotfiles-into-xdg-directories%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            13
            down vote













            Indeed, the current short answer to the question is you can't, as some application hardcode the path. Neither the less, many application which doesn't specifically support XDG directories enable to set other directories through environment variables. Some time you need to be able to change the system wide configuration, for example with shell, but most of the time, you should be able perform the step as a unprivileged user.



            Setting you shell



            # Setting bash to use $XDG_CONFIG_HOME/bash 

            ### Moving existing files
            mkdir -p $XDG_CONFIG_HOME/bash
            for file in ~/.bash*;do
            dest=${XDG_CONFIG_HOME}/bash/$(basename $file|cut -d. -f2)
            mv -i "$file" "$dest" # don't overwrite without permission
            done

            ### Sourcing and setting variables
            sudo sh -c 'cat >>/etc/profile.d/bash_in_xdg_config_home.sh <<CONF
            # Make bash follow the XDG_CONFIG_HOME convention
            if [ -d "$XDG_CONFIG_HOME/bash" ] && [ "$0" = "bash" ]
            then
            . "${XDG_CONFIG_HOME}/bash/bash_profile"
            . "${XDG_CONFIG_HOME}/bash/bashrc"
            HISTFILE="${XDG_CONFIG_HOME}/bash/bash_history"
            fi
            CONF
            '

            sudo sh -c 'cat >>/etc/bash.bash_logout <<CONF
            if [ -s "${XDG_CONFIG_HOME}/bash/bash_logout" ]
            then
            . "${XDG_CONFIG_HOME}/bash/bash_logout"
            fi
            CONF
            '

            # Setting zsh
            ## System wide configuration (using xdg directories)
            sudo sh -c 'cat >>/etc/zshenv <<CONF
            if [[ -z "$XDG_CONFIG_HOME" ]]
            then
            export XDG_CONFIG_HOME="$HOME/.config"
            fi

            if [[ -d "$XDG_CONFIG_HOME/zsh" ]]
            then
            export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
            fi
            CONF
            '


            If you use several shell, for example zsh for interactive shell, but an other for scripting, you may want to $XDG_CONFIG_HOME/profile file, that you will source in relevant shell initialization script.



            Setting environment variables



            # bazaar
            export BZRPATH=$XDG_CONFIG_HOME/bazaar
            export BZR_PLUGIN_PATH=$XDG_DATA_HOME/bazaar
            export BZR_HOME=$XDG_CACHE_HOME/bazaar

            # gnupg
            export GNUPGHOME=${XDG_CONFIG_HOME}/gnupg

            # ICEauthority
            export ICEAUTHORITY=${XDG_CACHE_HOME}/ICEauthority

            # less
            export LESSHISTFILE="${XDG_CONFIG_HOME}/less/history"
            export LESSKEY="${XDG_CONFIG_HOME}/less/keys"



            # mplayer
            export MPLAYER_HOME=$XDG_CONFIG_HOME/mplayer

            # subversion
            export SUBVERSION_HOME=$XDG_CONFIG_HOME/subversion


            # vim
            export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'
            export VIMDOTDIR="$XDG_CONFIG_HOME/vim"


            Work around



            SSH



            SSH does provide a way to change the client configuration file, but – as far as I found – only through command line. So one solution to always invoke the clients with a none default emplacement may be :



            if [ -s "${XDG_CONFIG_HOME}/ssh/config" ]
            then
            SSH_CONFIG="-F ${XDG_CONFIG_HOME}/ssh/config"
            fi
            if [ -s "${XDG_CONFIG_HOME}/ssh/id_dsa" ]
            then
            SSH_ID="-i ${XDG_CONFIG_HOME}/ssh/id_dsa"
            fi

            alias ssh="ssh $SSH_CONFIG $SSH_ID "
            alias ssh-copy-id="ssh-copy-id $SSH_ID"


            And your ${XDG_CONFIG_HOME}/ssh/config should contain something like :



            Host *
            IdentityFile /home/user/.config/ssh/id_dsa


            What doesn't work yet



            Although GNUPGHOME is a documented variable, under Fedora 21 you'll end up with the creation of a new ~/.gnupg directory when you launch a new session.



            Although ICEauthority is a documented variable, under Fedora 21 you'll end up with the creation of a new cookie when you launch a new session.



            The dotfile ~/.swt content should probably be stored directly into ${XDG_DATA_HOME}, as both have lib directories. No documentation was found on how to to that if it's possible.



            Mozilla products doesn't support an appropriate environment variable, see Mozilla products doesn't allow to use a custom user configuration directory and Support for the Freedesktop.org XDG Base Directory Specification.



            Other useful sources




            • Move your config files to $XDG_CONFIG_HOME

            • https://github.com/woegjiub/.config/blob/master/bash/xdg.sh


            • http://www.reddit.com/r/linux/comments/2v8rv2/move_your_config_files_to_xdg_config_home/ (Move your config files to $XDG_CONFIG_HOME)

            • https://github.com/grawity/dotfiles/blob/master/.dotfiles.notes






            share|improve this answer



















            • 1




              When using bash as interactive non-login shell (normal terminal usage), shouldn't /etc/profile be not read at all? Won't our definitions be not set then?
              – Hashken
              Apr 10 '15 at 10:29






            • 1




              According to the manpage on my system, you are right. Now what I would suggest you is to simply test, as it may depends on your system default configuration. Please give feed back, thank you.
              – psychoslave
              May 2 '15 at 8:54






            • 1




              I can confirm that /etc/profile is not read for non-login shells. But, if you open tmux your /etc/profile is read. This is because tmux opens all its shells as login shells.
              – Hashken
              May 2 '15 at 9:02






            • 1




              things like history files should be stored under $XDG_CACHE_HOME
              – user187717
              Jul 12 '15 at 11:46










            • 1) Add: export XAUTHORITY="$XDG_CACHE_HOME/Xauthority" 2) Please quote your variables! (see (1) for an example) 3) For my bash, I needed to: export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:="$HOME/.config"}
              – Tom Hale
              Sep 25 '16 at 15:18

















            up vote
            13
            down vote













            Indeed, the current short answer to the question is you can't, as some application hardcode the path. Neither the less, many application which doesn't specifically support XDG directories enable to set other directories through environment variables. Some time you need to be able to change the system wide configuration, for example with shell, but most of the time, you should be able perform the step as a unprivileged user.



            Setting you shell



            # Setting bash to use $XDG_CONFIG_HOME/bash 

            ### Moving existing files
            mkdir -p $XDG_CONFIG_HOME/bash
            for file in ~/.bash*;do
            dest=${XDG_CONFIG_HOME}/bash/$(basename $file|cut -d. -f2)
            mv -i "$file" "$dest" # don't overwrite without permission
            done

            ### Sourcing and setting variables
            sudo sh -c 'cat >>/etc/profile.d/bash_in_xdg_config_home.sh <<CONF
            # Make bash follow the XDG_CONFIG_HOME convention
            if [ -d "$XDG_CONFIG_HOME/bash" ] && [ "$0" = "bash" ]
            then
            . "${XDG_CONFIG_HOME}/bash/bash_profile"
            . "${XDG_CONFIG_HOME}/bash/bashrc"
            HISTFILE="${XDG_CONFIG_HOME}/bash/bash_history"
            fi
            CONF
            '

            sudo sh -c 'cat >>/etc/bash.bash_logout <<CONF
            if [ -s "${XDG_CONFIG_HOME}/bash/bash_logout" ]
            then
            . "${XDG_CONFIG_HOME}/bash/bash_logout"
            fi
            CONF
            '

            # Setting zsh
            ## System wide configuration (using xdg directories)
            sudo sh -c 'cat >>/etc/zshenv <<CONF
            if [[ -z "$XDG_CONFIG_HOME" ]]
            then
            export XDG_CONFIG_HOME="$HOME/.config"
            fi

            if [[ -d "$XDG_CONFIG_HOME/zsh" ]]
            then
            export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
            fi
            CONF
            '


            If you use several shell, for example zsh for interactive shell, but an other for scripting, you may want to $XDG_CONFIG_HOME/profile file, that you will source in relevant shell initialization script.



            Setting environment variables



            # bazaar
            export BZRPATH=$XDG_CONFIG_HOME/bazaar
            export BZR_PLUGIN_PATH=$XDG_DATA_HOME/bazaar
            export BZR_HOME=$XDG_CACHE_HOME/bazaar

            # gnupg
            export GNUPGHOME=${XDG_CONFIG_HOME}/gnupg

            # ICEauthority
            export ICEAUTHORITY=${XDG_CACHE_HOME}/ICEauthority

            # less
            export LESSHISTFILE="${XDG_CONFIG_HOME}/less/history"
            export LESSKEY="${XDG_CONFIG_HOME}/less/keys"



            # mplayer
            export MPLAYER_HOME=$XDG_CONFIG_HOME/mplayer

            # subversion
            export SUBVERSION_HOME=$XDG_CONFIG_HOME/subversion


            # vim
            export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'
            export VIMDOTDIR="$XDG_CONFIG_HOME/vim"


            Work around



            SSH



            SSH does provide a way to change the client configuration file, but – as far as I found – only through command line. So one solution to always invoke the clients with a none default emplacement may be :



            if [ -s "${XDG_CONFIG_HOME}/ssh/config" ]
            then
            SSH_CONFIG="-F ${XDG_CONFIG_HOME}/ssh/config"
            fi
            if [ -s "${XDG_CONFIG_HOME}/ssh/id_dsa" ]
            then
            SSH_ID="-i ${XDG_CONFIG_HOME}/ssh/id_dsa"
            fi

            alias ssh="ssh $SSH_CONFIG $SSH_ID "
            alias ssh-copy-id="ssh-copy-id $SSH_ID"


            And your ${XDG_CONFIG_HOME}/ssh/config should contain something like :



            Host *
            IdentityFile /home/user/.config/ssh/id_dsa


            What doesn't work yet



            Although GNUPGHOME is a documented variable, under Fedora 21 you'll end up with the creation of a new ~/.gnupg directory when you launch a new session.



            Although ICEauthority is a documented variable, under Fedora 21 you'll end up with the creation of a new cookie when you launch a new session.



            The dotfile ~/.swt content should probably be stored directly into ${XDG_DATA_HOME}, as both have lib directories. No documentation was found on how to to that if it's possible.



            Mozilla products doesn't support an appropriate environment variable, see Mozilla products doesn't allow to use a custom user configuration directory and Support for the Freedesktop.org XDG Base Directory Specification.



            Other useful sources




            • Move your config files to $XDG_CONFIG_HOME

            • https://github.com/woegjiub/.config/blob/master/bash/xdg.sh


            • http://www.reddit.com/r/linux/comments/2v8rv2/move_your_config_files_to_xdg_config_home/ (Move your config files to $XDG_CONFIG_HOME)

            • https://github.com/grawity/dotfiles/blob/master/.dotfiles.notes






            share|improve this answer



















            • 1




              When using bash as interactive non-login shell (normal terminal usage), shouldn't /etc/profile be not read at all? Won't our definitions be not set then?
              – Hashken
              Apr 10 '15 at 10:29






            • 1




              According to the manpage on my system, you are right. Now what I would suggest you is to simply test, as it may depends on your system default configuration. Please give feed back, thank you.
              – psychoslave
              May 2 '15 at 8:54






            • 1




              I can confirm that /etc/profile is not read for non-login shells. But, if you open tmux your /etc/profile is read. This is because tmux opens all its shells as login shells.
              – Hashken
              May 2 '15 at 9:02






            • 1




              things like history files should be stored under $XDG_CACHE_HOME
              – user187717
              Jul 12 '15 at 11:46










            • 1) Add: export XAUTHORITY="$XDG_CACHE_HOME/Xauthority" 2) Please quote your variables! (see (1) for an example) 3) For my bash, I needed to: export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:="$HOME/.config"}
              – Tom Hale
              Sep 25 '16 at 15:18















            up vote
            13
            down vote










            up vote
            13
            down vote









            Indeed, the current short answer to the question is you can't, as some application hardcode the path. Neither the less, many application which doesn't specifically support XDG directories enable to set other directories through environment variables. Some time you need to be able to change the system wide configuration, for example with shell, but most of the time, you should be able perform the step as a unprivileged user.



            Setting you shell



            # Setting bash to use $XDG_CONFIG_HOME/bash 

            ### Moving existing files
            mkdir -p $XDG_CONFIG_HOME/bash
            for file in ~/.bash*;do
            dest=${XDG_CONFIG_HOME}/bash/$(basename $file|cut -d. -f2)
            mv -i "$file" "$dest" # don't overwrite without permission
            done

            ### Sourcing and setting variables
            sudo sh -c 'cat >>/etc/profile.d/bash_in_xdg_config_home.sh <<CONF
            # Make bash follow the XDG_CONFIG_HOME convention
            if [ -d "$XDG_CONFIG_HOME/bash" ] && [ "$0" = "bash" ]
            then
            . "${XDG_CONFIG_HOME}/bash/bash_profile"
            . "${XDG_CONFIG_HOME}/bash/bashrc"
            HISTFILE="${XDG_CONFIG_HOME}/bash/bash_history"
            fi
            CONF
            '

            sudo sh -c 'cat >>/etc/bash.bash_logout <<CONF
            if [ -s "${XDG_CONFIG_HOME}/bash/bash_logout" ]
            then
            . "${XDG_CONFIG_HOME}/bash/bash_logout"
            fi
            CONF
            '

            # Setting zsh
            ## System wide configuration (using xdg directories)
            sudo sh -c 'cat >>/etc/zshenv <<CONF
            if [[ -z "$XDG_CONFIG_HOME" ]]
            then
            export XDG_CONFIG_HOME="$HOME/.config"
            fi

            if [[ -d "$XDG_CONFIG_HOME/zsh" ]]
            then
            export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
            fi
            CONF
            '


            If you use several shell, for example zsh for interactive shell, but an other for scripting, you may want to $XDG_CONFIG_HOME/profile file, that you will source in relevant shell initialization script.



            Setting environment variables



            # bazaar
            export BZRPATH=$XDG_CONFIG_HOME/bazaar
            export BZR_PLUGIN_PATH=$XDG_DATA_HOME/bazaar
            export BZR_HOME=$XDG_CACHE_HOME/bazaar

            # gnupg
            export GNUPGHOME=${XDG_CONFIG_HOME}/gnupg

            # ICEauthority
            export ICEAUTHORITY=${XDG_CACHE_HOME}/ICEauthority

            # less
            export LESSHISTFILE="${XDG_CONFIG_HOME}/less/history"
            export LESSKEY="${XDG_CONFIG_HOME}/less/keys"



            # mplayer
            export MPLAYER_HOME=$XDG_CONFIG_HOME/mplayer

            # subversion
            export SUBVERSION_HOME=$XDG_CONFIG_HOME/subversion


            # vim
            export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'
            export VIMDOTDIR="$XDG_CONFIG_HOME/vim"


            Work around



            SSH



            SSH does provide a way to change the client configuration file, but – as far as I found – only through command line. So one solution to always invoke the clients with a none default emplacement may be :



            if [ -s "${XDG_CONFIG_HOME}/ssh/config" ]
            then
            SSH_CONFIG="-F ${XDG_CONFIG_HOME}/ssh/config"
            fi
            if [ -s "${XDG_CONFIG_HOME}/ssh/id_dsa" ]
            then
            SSH_ID="-i ${XDG_CONFIG_HOME}/ssh/id_dsa"
            fi

            alias ssh="ssh $SSH_CONFIG $SSH_ID "
            alias ssh-copy-id="ssh-copy-id $SSH_ID"


            And your ${XDG_CONFIG_HOME}/ssh/config should contain something like :



            Host *
            IdentityFile /home/user/.config/ssh/id_dsa


            What doesn't work yet



            Although GNUPGHOME is a documented variable, under Fedora 21 you'll end up with the creation of a new ~/.gnupg directory when you launch a new session.



            Although ICEauthority is a documented variable, under Fedora 21 you'll end up with the creation of a new cookie when you launch a new session.



            The dotfile ~/.swt content should probably be stored directly into ${XDG_DATA_HOME}, as both have lib directories. No documentation was found on how to to that if it's possible.



            Mozilla products doesn't support an appropriate environment variable, see Mozilla products doesn't allow to use a custom user configuration directory and Support for the Freedesktop.org XDG Base Directory Specification.



            Other useful sources




            • Move your config files to $XDG_CONFIG_HOME

            • https://github.com/woegjiub/.config/blob/master/bash/xdg.sh


            • http://www.reddit.com/r/linux/comments/2v8rv2/move_your_config_files_to_xdg_config_home/ (Move your config files to $XDG_CONFIG_HOME)

            • https://github.com/grawity/dotfiles/blob/master/.dotfiles.notes






            share|improve this answer














            Indeed, the current short answer to the question is you can't, as some application hardcode the path. Neither the less, many application which doesn't specifically support XDG directories enable to set other directories through environment variables. Some time you need to be able to change the system wide configuration, for example with shell, but most of the time, you should be able perform the step as a unprivileged user.



            Setting you shell



            # Setting bash to use $XDG_CONFIG_HOME/bash 

            ### Moving existing files
            mkdir -p $XDG_CONFIG_HOME/bash
            for file in ~/.bash*;do
            dest=${XDG_CONFIG_HOME}/bash/$(basename $file|cut -d. -f2)
            mv -i "$file" "$dest" # don't overwrite without permission
            done

            ### Sourcing and setting variables
            sudo sh -c 'cat >>/etc/profile.d/bash_in_xdg_config_home.sh <<CONF
            # Make bash follow the XDG_CONFIG_HOME convention
            if [ -d "$XDG_CONFIG_HOME/bash" ] && [ "$0" = "bash" ]
            then
            . "${XDG_CONFIG_HOME}/bash/bash_profile"
            . "${XDG_CONFIG_HOME}/bash/bashrc"
            HISTFILE="${XDG_CONFIG_HOME}/bash/bash_history"
            fi
            CONF
            '

            sudo sh -c 'cat >>/etc/bash.bash_logout <<CONF
            if [ -s "${XDG_CONFIG_HOME}/bash/bash_logout" ]
            then
            . "${XDG_CONFIG_HOME}/bash/bash_logout"
            fi
            CONF
            '

            # Setting zsh
            ## System wide configuration (using xdg directories)
            sudo sh -c 'cat >>/etc/zshenv <<CONF
            if [[ -z "$XDG_CONFIG_HOME" ]]
            then
            export XDG_CONFIG_HOME="$HOME/.config"
            fi

            if [[ -d "$XDG_CONFIG_HOME/zsh" ]]
            then
            export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
            fi
            CONF
            '


            If you use several shell, for example zsh for interactive shell, but an other for scripting, you may want to $XDG_CONFIG_HOME/profile file, that you will source in relevant shell initialization script.



            Setting environment variables



            # bazaar
            export BZRPATH=$XDG_CONFIG_HOME/bazaar
            export BZR_PLUGIN_PATH=$XDG_DATA_HOME/bazaar
            export BZR_HOME=$XDG_CACHE_HOME/bazaar

            # gnupg
            export GNUPGHOME=${XDG_CONFIG_HOME}/gnupg

            # ICEauthority
            export ICEAUTHORITY=${XDG_CACHE_HOME}/ICEauthority

            # less
            export LESSHISTFILE="${XDG_CONFIG_HOME}/less/history"
            export LESSKEY="${XDG_CONFIG_HOME}/less/keys"



            # mplayer
            export MPLAYER_HOME=$XDG_CONFIG_HOME/mplayer

            # subversion
            export SUBVERSION_HOME=$XDG_CONFIG_HOME/subversion


            # vim
            export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'
            export VIMDOTDIR="$XDG_CONFIG_HOME/vim"


            Work around



            SSH



            SSH does provide a way to change the client configuration file, but – as far as I found – only through command line. So one solution to always invoke the clients with a none default emplacement may be :



            if [ -s "${XDG_CONFIG_HOME}/ssh/config" ]
            then
            SSH_CONFIG="-F ${XDG_CONFIG_HOME}/ssh/config"
            fi
            if [ -s "${XDG_CONFIG_HOME}/ssh/id_dsa" ]
            then
            SSH_ID="-i ${XDG_CONFIG_HOME}/ssh/id_dsa"
            fi

            alias ssh="ssh $SSH_CONFIG $SSH_ID "
            alias ssh-copy-id="ssh-copy-id $SSH_ID"


            And your ${XDG_CONFIG_HOME}/ssh/config should contain something like :



            Host *
            IdentityFile /home/user/.config/ssh/id_dsa


            What doesn't work yet



            Although GNUPGHOME is a documented variable, under Fedora 21 you'll end up with the creation of a new ~/.gnupg directory when you launch a new session.



            Although ICEauthority is a documented variable, under Fedora 21 you'll end up with the creation of a new cookie when you launch a new session.



            The dotfile ~/.swt content should probably be stored directly into ${XDG_DATA_HOME}, as both have lib directories. No documentation was found on how to to that if it's possible.



            Mozilla products doesn't support an appropriate environment variable, see Mozilla products doesn't allow to use a custom user configuration directory and Support for the Freedesktop.org XDG Base Directory Specification.



            Other useful sources




            • Move your config files to $XDG_CONFIG_HOME

            • https://github.com/woegjiub/.config/blob/master/bash/xdg.sh


            • http://www.reddit.com/r/linux/comments/2v8rv2/move_your_config_files_to_xdg_config_home/ (Move your config files to $XDG_CONFIG_HOME)

            • https://github.com/grawity/dotfiles/blob/master/.dotfiles.notes







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Feb 21 '17 at 15:03

























            answered Feb 7 '15 at 12:50









            psychoslave

            328212




            328212








            • 1




              When using bash as interactive non-login shell (normal terminal usage), shouldn't /etc/profile be not read at all? Won't our definitions be not set then?
              – Hashken
              Apr 10 '15 at 10:29






            • 1




              According to the manpage on my system, you are right. Now what I would suggest you is to simply test, as it may depends on your system default configuration. Please give feed back, thank you.
              – psychoslave
              May 2 '15 at 8:54






            • 1




              I can confirm that /etc/profile is not read for non-login shells. But, if you open tmux your /etc/profile is read. This is because tmux opens all its shells as login shells.
              – Hashken
              May 2 '15 at 9:02






            • 1




              things like history files should be stored under $XDG_CACHE_HOME
              – user187717
              Jul 12 '15 at 11:46










            • 1) Add: export XAUTHORITY="$XDG_CACHE_HOME/Xauthority" 2) Please quote your variables! (see (1) for an example) 3) For my bash, I needed to: export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:="$HOME/.config"}
              – Tom Hale
              Sep 25 '16 at 15:18
















            • 1




              When using bash as interactive non-login shell (normal terminal usage), shouldn't /etc/profile be not read at all? Won't our definitions be not set then?
              – Hashken
              Apr 10 '15 at 10:29






            • 1




              According to the manpage on my system, you are right. Now what I would suggest you is to simply test, as it may depends on your system default configuration. Please give feed back, thank you.
              – psychoslave
              May 2 '15 at 8:54






            • 1




              I can confirm that /etc/profile is not read for non-login shells. But, if you open tmux your /etc/profile is read. This is because tmux opens all its shells as login shells.
              – Hashken
              May 2 '15 at 9:02






            • 1




              things like history files should be stored under $XDG_CACHE_HOME
              – user187717
              Jul 12 '15 at 11:46










            • 1) Add: export XAUTHORITY="$XDG_CACHE_HOME/Xauthority" 2) Please quote your variables! (see (1) for an example) 3) For my bash, I needed to: export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:="$HOME/.config"}
              – Tom Hale
              Sep 25 '16 at 15:18










            1




            1




            When using bash as interactive non-login shell (normal terminal usage), shouldn't /etc/profile be not read at all? Won't our definitions be not set then?
            – Hashken
            Apr 10 '15 at 10:29




            When using bash as interactive non-login shell (normal terminal usage), shouldn't /etc/profile be not read at all? Won't our definitions be not set then?
            – Hashken
            Apr 10 '15 at 10:29




            1




            1




            According to the manpage on my system, you are right. Now what I would suggest you is to simply test, as it may depends on your system default configuration. Please give feed back, thank you.
            – psychoslave
            May 2 '15 at 8:54




            According to the manpage on my system, you are right. Now what I would suggest you is to simply test, as it may depends on your system default configuration. Please give feed back, thank you.
            – psychoslave
            May 2 '15 at 8:54




            1




            1




            I can confirm that /etc/profile is not read for non-login shells. But, if you open tmux your /etc/profile is read. This is because tmux opens all its shells as login shells.
            – Hashken
            May 2 '15 at 9:02




            I can confirm that /etc/profile is not read for non-login shells. But, if you open tmux your /etc/profile is read. This is because tmux opens all its shells as login shells.
            – Hashken
            May 2 '15 at 9:02




            1




            1




            things like history files should be stored under $XDG_CACHE_HOME
            – user187717
            Jul 12 '15 at 11:46




            things like history files should be stored under $XDG_CACHE_HOME
            – user187717
            Jul 12 '15 at 11:46












            1) Add: export XAUTHORITY="$XDG_CACHE_HOME/Xauthority" 2) Please quote your variables! (see (1) for an example) 3) For my bash, I needed to: export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:="$HOME/.config"}
            – Tom Hale
            Sep 25 '16 at 15:18






            1) Add: export XAUTHORITY="$XDG_CACHE_HOME/Xauthority" 2) Please quote your variables! (see (1) for an example) 3) For my bash, I needed to: export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:="$HOME/.config"}
            – Tom Hale
            Sep 25 '16 at 15:18














            up vote
            5
            down vote













            I recommend consulting the Arch Linux wiki page XDG Base Directory support which is continuously updated.



            GIT



            I just moved my .gitconfig to XDG_CONFIG_HOME on OSX. Per the git-config documentation (link omitted due to reputation).



            Second user-specific configuration file. If $XDG_CONFIG_HOME is not set or
            empty, $HOME/.config/git/config will be used. Any single-valued variable
            set in this file will be overwritten by whatever is in ~/.gitconfig. It is
            a good idea not to create this file if you sometimes use older versions of
            Git, as support for this file was added fairly recently.


            I set the environment variable using the instructions in Setting the system-wide PATH environment variable in Mavericks. Note that you will need to create the file XDG_CONFIG_HOME/git/config yourself and if ~/.gitconfig exists it will take precedence.



            VIM



            I used Tom Vincent's 2011 article Vim respect XDG and it seems to work. I'm not sure about the above answer; VIMDOTDIR doesn't seem to be a thing.






            share|improve this answer























            • Note: I'm moving to using nixos.org which makes it possible to completely control all configuration in an elegant manner
              – Ben Creasy
              May 8 at 18:48















            up vote
            5
            down vote













            I recommend consulting the Arch Linux wiki page XDG Base Directory support which is continuously updated.



            GIT



            I just moved my .gitconfig to XDG_CONFIG_HOME on OSX. Per the git-config documentation (link omitted due to reputation).



            Second user-specific configuration file. If $XDG_CONFIG_HOME is not set or
            empty, $HOME/.config/git/config will be used. Any single-valued variable
            set in this file will be overwritten by whatever is in ~/.gitconfig. It is
            a good idea not to create this file if you sometimes use older versions of
            Git, as support for this file was added fairly recently.


            I set the environment variable using the instructions in Setting the system-wide PATH environment variable in Mavericks. Note that you will need to create the file XDG_CONFIG_HOME/git/config yourself and if ~/.gitconfig exists it will take precedence.



            VIM



            I used Tom Vincent's 2011 article Vim respect XDG and it seems to work. I'm not sure about the above answer; VIMDOTDIR doesn't seem to be a thing.






            share|improve this answer























            • Note: I'm moving to using nixos.org which makes it possible to completely control all configuration in an elegant manner
              – Ben Creasy
              May 8 at 18:48













            up vote
            5
            down vote










            up vote
            5
            down vote









            I recommend consulting the Arch Linux wiki page XDG Base Directory support which is continuously updated.



            GIT



            I just moved my .gitconfig to XDG_CONFIG_HOME on OSX. Per the git-config documentation (link omitted due to reputation).



            Second user-specific configuration file. If $XDG_CONFIG_HOME is not set or
            empty, $HOME/.config/git/config will be used. Any single-valued variable
            set in this file will be overwritten by whatever is in ~/.gitconfig. It is
            a good idea not to create this file if you sometimes use older versions of
            Git, as support for this file was added fairly recently.


            I set the environment variable using the instructions in Setting the system-wide PATH environment variable in Mavericks. Note that you will need to create the file XDG_CONFIG_HOME/git/config yourself and if ~/.gitconfig exists it will take precedence.



            VIM



            I used Tom Vincent's 2011 article Vim respect XDG and it seems to work. I'm not sure about the above answer; VIMDOTDIR doesn't seem to be a thing.






            share|improve this answer














            I recommend consulting the Arch Linux wiki page XDG Base Directory support which is continuously updated.



            GIT



            I just moved my .gitconfig to XDG_CONFIG_HOME on OSX. Per the git-config documentation (link omitted due to reputation).



            Second user-specific configuration file. If $XDG_CONFIG_HOME is not set or
            empty, $HOME/.config/git/config will be used. Any single-valued variable
            set in this file will be overwritten by whatever is in ~/.gitconfig. It is
            a good idea not to create this file if you sometimes use older versions of
            Git, as support for this file was added fairly recently.


            I set the environment variable using the instructions in Setting the system-wide PATH environment variable in Mavericks. Note that you will need to create the file XDG_CONFIG_HOME/git/config yourself and if ~/.gitconfig exists it will take precedence.



            VIM



            I used Tom Vincent's 2011 article Vim respect XDG and it seems to work. I'm not sure about the above answer; VIMDOTDIR doesn't seem to be a thing.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Apr 13 '17 at 12:45









            Community

            1




            1










            answered Jun 22 '15 at 23:09









            Ben Creasy

            266211




            266211












            • Note: I'm moving to using nixos.org which makes it possible to completely control all configuration in an elegant manner
              – Ben Creasy
              May 8 at 18:48


















            • Note: I'm moving to using nixos.org which makes it possible to completely control all configuration in an elegant manner
              – Ben Creasy
              May 8 at 18:48
















            Note: I'm moving to using nixos.org which makes it possible to completely control all configuration in an elegant manner
            – Ben Creasy
            May 8 at 18:48




            Note: I'm moving to using nixos.org which makes it possible to completely control all configuration in an elegant manner
            – Ben Creasy
            May 8 at 18:48










            up vote
            0
            down vote













            Zsh does a slightly better job than bash letting you de-clutter your home using the $ZDOTDIR variable. To move zsh out of the way, you need to add the following to your ~/.zshenv file:



            # ~/.zshenv contents
            # this is the bare bones setup to move everything to XDG dir
            ZDOTDIR=$HOME/.config/zsh


            If you have root privledges, you could add this instead to /etc/zsh/zshenv and avoid the need for any zsh dotfiles in your $HOME. From here, all your other zsh dotfiles can be moved to ~/.config/zsh, like .zshrc. I also recommend adding your zsh history to the $XDG_DATA_HOME location: HISTFILE=$XDG_DATA_HOME/zsh/zsh_history.



            Some apps will look for the XDG locations by default and you may not even realize it because you still have a legacy dotfile in your $HOME directory. Git is a good example of this - if you have a ~/.gitconfig, try moving it to ~/.config/git/config. My personal favorite, Fish Shell, uses ~/.config by default too.



            Also, check your other apps for their own version of a re-$HOME-ing variable. Many support it XDG via a variable:




            • Atom: export ATOM_HOME=$XDG_CONFIG_HOME/atom

            • lpass: export LPASS_HOME=$XDG_CONFIG_HOME/lpass

            • rupa/z has one: export _Z_DATA=$XDG_DATA_HOME/z/z.txt


            But there's still quite an extensive XDG wall of shame. Tmux has been actively hostile to supporting de-cluttering your $HOME. Same with pylint. And Julia. And the list goes on. Arch keeps a nice running list of XDG support here.



            Honestly, I can't understand the resistance to supporting it. Users need to clearly send a clear message that apps shouldn't be running roughshod over their $HOME. It's not okay anymore. A modern system uses hundreds of apps that pollute $HOME, not tens like it used to be 20 years ago.






            share|improve this answer



























              up vote
              0
              down vote













              Zsh does a slightly better job than bash letting you de-clutter your home using the $ZDOTDIR variable. To move zsh out of the way, you need to add the following to your ~/.zshenv file:



              # ~/.zshenv contents
              # this is the bare bones setup to move everything to XDG dir
              ZDOTDIR=$HOME/.config/zsh


              If you have root privledges, you could add this instead to /etc/zsh/zshenv and avoid the need for any zsh dotfiles in your $HOME. From here, all your other zsh dotfiles can be moved to ~/.config/zsh, like .zshrc. I also recommend adding your zsh history to the $XDG_DATA_HOME location: HISTFILE=$XDG_DATA_HOME/zsh/zsh_history.



              Some apps will look for the XDG locations by default and you may not even realize it because you still have a legacy dotfile in your $HOME directory. Git is a good example of this - if you have a ~/.gitconfig, try moving it to ~/.config/git/config. My personal favorite, Fish Shell, uses ~/.config by default too.



              Also, check your other apps for their own version of a re-$HOME-ing variable. Many support it XDG via a variable:




              • Atom: export ATOM_HOME=$XDG_CONFIG_HOME/atom

              • lpass: export LPASS_HOME=$XDG_CONFIG_HOME/lpass

              • rupa/z has one: export _Z_DATA=$XDG_DATA_HOME/z/z.txt


              But there's still quite an extensive XDG wall of shame. Tmux has been actively hostile to supporting de-cluttering your $HOME. Same with pylint. And Julia. And the list goes on. Arch keeps a nice running list of XDG support here.



              Honestly, I can't understand the resistance to supporting it. Users need to clearly send a clear message that apps shouldn't be running roughshod over their $HOME. It's not okay anymore. A modern system uses hundreds of apps that pollute $HOME, not tens like it used to be 20 years ago.






              share|improve this answer

























                up vote
                0
                down vote










                up vote
                0
                down vote









                Zsh does a slightly better job than bash letting you de-clutter your home using the $ZDOTDIR variable. To move zsh out of the way, you need to add the following to your ~/.zshenv file:



                # ~/.zshenv contents
                # this is the bare bones setup to move everything to XDG dir
                ZDOTDIR=$HOME/.config/zsh


                If you have root privledges, you could add this instead to /etc/zsh/zshenv and avoid the need for any zsh dotfiles in your $HOME. From here, all your other zsh dotfiles can be moved to ~/.config/zsh, like .zshrc. I also recommend adding your zsh history to the $XDG_DATA_HOME location: HISTFILE=$XDG_DATA_HOME/zsh/zsh_history.



                Some apps will look for the XDG locations by default and you may not even realize it because you still have a legacy dotfile in your $HOME directory. Git is a good example of this - if you have a ~/.gitconfig, try moving it to ~/.config/git/config. My personal favorite, Fish Shell, uses ~/.config by default too.



                Also, check your other apps for their own version of a re-$HOME-ing variable. Many support it XDG via a variable:




                • Atom: export ATOM_HOME=$XDG_CONFIG_HOME/atom

                • lpass: export LPASS_HOME=$XDG_CONFIG_HOME/lpass

                • rupa/z has one: export _Z_DATA=$XDG_DATA_HOME/z/z.txt


                But there's still quite an extensive XDG wall of shame. Tmux has been actively hostile to supporting de-cluttering your $HOME. Same with pylint. And Julia. And the list goes on. Arch keeps a nice running list of XDG support here.



                Honestly, I can't understand the resistance to supporting it. Users need to clearly send a clear message that apps shouldn't be running roughshod over their $HOME. It's not okay anymore. A modern system uses hundreds of apps that pollute $HOME, not tens like it used to be 20 years ago.






                share|improve this answer














                Zsh does a slightly better job than bash letting you de-clutter your home using the $ZDOTDIR variable. To move zsh out of the way, you need to add the following to your ~/.zshenv file:



                # ~/.zshenv contents
                # this is the bare bones setup to move everything to XDG dir
                ZDOTDIR=$HOME/.config/zsh


                If you have root privledges, you could add this instead to /etc/zsh/zshenv and avoid the need for any zsh dotfiles in your $HOME. From here, all your other zsh dotfiles can be moved to ~/.config/zsh, like .zshrc. I also recommend adding your zsh history to the $XDG_DATA_HOME location: HISTFILE=$XDG_DATA_HOME/zsh/zsh_history.



                Some apps will look for the XDG locations by default and you may not even realize it because you still have a legacy dotfile in your $HOME directory. Git is a good example of this - if you have a ~/.gitconfig, try moving it to ~/.config/git/config. My personal favorite, Fish Shell, uses ~/.config by default too.



                Also, check your other apps for their own version of a re-$HOME-ing variable. Many support it XDG via a variable:




                • Atom: export ATOM_HOME=$XDG_CONFIG_HOME/atom

                • lpass: export LPASS_HOME=$XDG_CONFIG_HOME/lpass

                • rupa/z has one: export _Z_DATA=$XDG_DATA_HOME/z/z.txt


                But there's still quite an extensive XDG wall of shame. Tmux has been actively hostile to supporting de-cluttering your $HOME. Same with pylint. And Julia. And the list goes on. Arch keeps a nice running list of XDG support here.



                Honestly, I can't understand the resistance to supporting it. Users need to clearly send a clear message that apps shouldn't be running roughshod over their $HOME. It's not okay anymore. A modern system uses hundreds of apps that pollute $HOME, not tens like it used to be 20 years ago.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 26 at 0:05

























                answered Nov 25 at 23:36









                mattmc3

                506




                506






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f874901%2fwhat-are-the-step-to-move-all-your-dotfiles-into-xdg-directories%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Сан-Квентин

                    8-я гвардейская общевойсковая армия

                    Алькесар