XDG All the Things or how to bring sanity to your $HOME

Apr 3, 2021

If you are like me, you like to keep your $HOME clean. I am not talking about my flat, though, which is pretty tidy thanks to my wife 😏. I am talking about the home directory on UNIX like system. The number of dotfiles (e.g. .bashrc) dumped in $HOME is just bonkers. Somehow $HOME has become the dumping ground for settings, caches and custom data for pretty much every app and cli out there.

Before moving everything to a dedicated config folder, I had 120 such dotfiles (most of which I have no idea how they got there). The point is that $HOME is a place that I, as the user, want to control.

Fortunately, there is a solution to this problem. Adopt the XDG approach/convention to manage these auxiliary files.

The XDG config specification sets out where config, cache and data for an app/cli should be placed, such that they do not pollute the $HOME.

The ArchWiki maintains a list of instructions on how to set up your environment such that many apps conform to this spec.