mainThe GNU Bourne-Again SHell - Support: sr #108134, Use XDG dirs instead of $HOME


sr #108134: Use XDG dirs instead of $HOME

Submitter:  Oliver Propst <oliverp>
Submitted:  Sun 16 Sep 2012 11:11:47 AM UTC
Votes: 450
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Wont Do
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Thu 24 Nov 2022 02:50:46 PM UTC, comment #11: 

> There's no reason to change historical behavior here.  All the world is not Linux.

I think nobody said to enforce said behaviour or said it something that applies to Linux only.

An option would be:
1. Enable it only when requested during build.
2. Enable it on all platforms using XDG but prefer the regular path first.
3. Prefer the XDG path on XDG-platforms then load the regular
4. Add a even variable that allows to change the location of bashrc and friends.

4. isn't as nice however there are also other uses cases to do so.

Thu 17 Nov 2022 10:34:14 AM UTC, comment #10: 

"All the world is not linux" is an understatement. XDG base spec also supports BSD, as well as mac. Throwing everything in root home directory is never a well thought idea. It doesn't change the fact & not even worth arguing over.

Archer <archer>
Sun 16 Oct 2022 09:48:44 AM UTC, comment #9: 

There was a patch to implement this from 2014:

It doesn't seem to have been accepted.

Sat 27 Aug 2022 07:36:27 PM UTC, comment #8: 

Hello, I'd like this feature too (supporting moving configuration files to a user-specified directory). My goal is to organize my home directory and centralize all user configuration in a single directory that's not hidden (doesn't start with a dot). I expect to reduce my home directory by almost 70 files and keep only 2 dozen directories in it, none of them being hidden files.

Wed 17 Aug 2022 09:44:39 PM UTC, comment #7: 

1. Here's my two cents. Hosting or version controlling configuration files becomes dead simple when everything is in XDG_CONFIG_HOME. No symlink hell. Oh, and easy to omit cache that isn't essential when it's time for backups / disk cleaning.

2. I'm compelled to argue towards the opposite. Not following this standard will continue to create edge-cases that have to be accounted for by every user that attempts to interact with bash but knows about the XDG base directory spec.

gabrielhansson <gibbz>
Mon 25 Jul 2022 02:22:54 PM UTC, comment #6: 

Because someone has to add that support, which leads to two reasons:

1. No one has ever been able to articulate a compelling reason
   for adding this that doesn't ultimately come down to circular
   reasoning; and

2. It adds technical debt that has to be carried.

Chet Ramey <chet>
Group administrator
Sat 23 Jul 2022 01:13:25 PM UTC, comment #5: 

What about just adding support for it, simply add an option to enable support for XDG dirs.

BWKC <bwkc>
Wed 12 Oct 2016 03:25:05 AM UTC, comment #4: 

The Bourne-Again Shell is sadly one of the few software tools still not implementing the  XDG Base Directory Specification:

Chris <cseelus>
Fri 13 Nov 2015 02:36:20 AM UTC, comment #3: 

There's no reason to change historical behavior here.  All the world is not Linux.

Chet Ramey <chet>
Group administrator
Sat 05 Jan 2013 09:24:33 AM UTC, comment #2: 

According to XDG Base directory specification,
user preferences should go into $XDG_CONFIG_HOME (which default to ~/.config)
and cached data should go to $XDG_CACHE_HOME (which default to ~/.cache).
More details at :

Full specification can be found at:

The XDG base directory specification have good de facto adoption.
It has been adopted by:
- GNOME ( )
- GTK+ ( )
- KDE ( )
- QT ( )
- XFCE ( in Files and Environment Variables )
- Razor-qt
- VLC ( )
- GStreamer ( )
- Chrome ( )
- many more upstream applications
- Ubuntu ( & )
- Debian ( )
- Red Hat
- Fedora
- Suse
- many more distributions

I think that bash should use same locations than the vast majority of Desktop environment and applications.

There are real advantages of following this specification :
- a lot less cluttered $HOME
- Make backups a lot more safer and easier.
  Backuping your $XDG_DATA_HOME along with your files is enough
  (or just excluding $XDG_CACHE_HOME)
- A lot easier to reset a default configuration if you want/need it (and
  without any risk to loose informations). Even for the software itself
  could choose to reset $XDG_CONFIG_HOME if needed.
- Avoid some strange bugs that happens because you had a old version of
  some configuration file
- A lot more of flexibility and portability because no path are hardcoded.

Eric Heintzmann <eheintzmann>
Wed 21 Nov 2012 12:32:53 PM UTC, comment #1: 
  • ping
FaisPas <faispasierch>
Sun 16 Sep 2012 11:11:47 AM UTC, original submission:  

Bash stores ~/.bash_aliases , ~/.bash_history, ~/.bash_logout and ~/.bashrc in the home directory. It would be better to store these files according to the XDG Base Directory Specification.

Oliver Propst <oliverp>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by archer (Posted a comment)
  • -email is unavailable- added by gibbz (Posted a comment)
  • -email is unavailable- added by bwkc (Posted a comment)
  • -email is unavailable- added by whenov (Voted in favor of this item)
  • -email is unavailable- added by dfrankcom (Voted in favor of this item)
  • -email is unavailable- added by k41eb (Voted in favor of this item)
  • -email is unavailable- added by hannavasung
  • -email is unavailable- added by adrianheine (Voted in favor of this item)
  • -email is unavailable- added by cseelus (Posted a comment)
  • -email is unavailable- added by cseelus (Voted in favor of this item)
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by eheintzmann (Posted a comment)
  • -email is unavailable- added by faispasierch (Posted a comment)
  • -email is unavailable- added by oliverp (Submitted the item)

    There are 450 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-12-24 whenov Carbon-Copy- Added whenov
    2020-09-12 dfrankcom Carbon-Copy- Added dfrankcom
    2019-12-08 k41eb Carbon-Copy- Added k41eb
    2017-09-19 hannavasung Carbon-Copy- Added hannavasung
    2017-02-08 adrianheine Carbon-Copy- Added adrianheine
    2016-10-12 cseelus Carbon-Copy- Added cseelus
    2015-11-13 chet StatusNone Wont Do

    Back to the top

    Powered by Savane 3.12