How I Keep My Home Directory Clean
Author: Jake Bauer | Published: 2020-06-28
Note: I have stopped caring about keeping my home
directory clean. While it might be nice to do an
ls -a and
see hardly anything, it just wasn't worth the continual effort to
wrangle programs into behaving. Not to mention, many programs I use are
old enough that they predate the XDG specification and therefore don't
Update: The name of the tool mentioned later in the post is rehome. Also added a screenshot showing the current state of my home directory.
I am one of those people who likes to keep files organized and directories clean. Unfortunately, it seems many software developers don’t care about this and like to dump their program’s configuration and state information into my home directory, rather than putting it in the proper XDG specified directories. I’ve gone through quite a bit of effort, mainly using the Arch Wiki’s page on the XDG Base Directory specification, to clean up my home directory from a lot of the cruft programs like to leave lying around.
Most programs, if they don’t already recognize the
variable, have their own environment variables that they look at to find the
location of configuration data. Some examples from my
export XAUTHORITY="$XDG_CONFIG_HOME/X11/Xauthority" export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc"
Which get rid of the
.Xauthority files which would normally sit
in the home directory.
Some programs, however, don’t have environment variables but can still be told
where to find configuration information using a command line switch. For
example, in my
.bashrc I have the aliases:
alias tmux='tmux -f "$XDG_CONFIG_HOME"/tmux/tmux.conf' alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
tmux to find its configuration in a directory in the
wget to store its history in the
Unfortunately, even with changes in
.profile and aliases in
are still programs which are hardcoded to put files in the home directory.
Programs like Firefox, SSH, and Vim (although NeoVim respects XDG), are so old
and well-established that the developers are reluctant to change anything for
fear of breaking things that expect the files to be there.
I have heard of a program designed to trick other programs into thinking the home is actually in the XDG directories so that they are, in a way, forced to respect the specification. However, I’m alright with a few programs here and there in my home directory as long as it doesn’t get needlessly cluttered. If you’re developing a brand new application there’s no excuse; please respect the XDG base directory specification!
This is my fifty-seventh post for the #100DaysToOffload challenge. You can learn more about this challenge over at https://100daystooffload.com.