···11+---
22+title: "Stop Spreading C\\*\\*p at My `$HOME`"
33+date: 2020-04-15T12:00:19+02:00
44+tags:
55+ - programming
66+ - culture
77+---
88+99+**Disclaimer:** Yes, this is a rant. Yes, I am displeased with state of
1010+software. And yes, I can use some harsh words. You were warned.
1111+1212+For a some time now we have [Filesystem Hierarchy Standard][fhs] which describes
1313+which data goes where in your \*nix installation. In fact we have that for 28
1414+years, which is almost as long as I live. This is quite some time. But for
1515+whatever reason we apply that only for the system hierarchy and we cannot have
1616+the same for something much closer to our heart - our dear `$HOME`.
1717+1818+Common practice for storing all the stuff for different applications is to use
1919+dot files stored in `$HOME`. These are files or directories starting with dot in
2020+their name which makes such files "hidden" on Unix systems. There is problem
2121+though. First let me show you all the files starting with dot in my `$HOME`:
2222+2323+```
2424+-r-------- 1 hauleth staff 9 Mar 30 2019 .CFUserTextEncoding
2525+-rw-r--r-- 1 hauleth staff 16388 Apr 9 11:46 .DS_Store
2626+drwx------ 2 hauleth staff 64 Apr 13 20:54 .Trash
2727+-rw------- 1 hauleth staff 17835 Apr 10 21:17 .bash_history
2828+drwx------ 12 hauleth staff 384 Mar 30 2019 .bash_sessions
2929+drwxr-xr-x 13 hauleth staff 416 Mar 26 14:02 .cache
3030+lrwxr-xr-x 1 hauleth staff 40 Aug 21 2019 .chunkwmrc
3131+drwxr-xr-x 20 hauleth staff 640 Apr 15 21:59 .config
3232+drwx------ 3 hauleth staff 96 Apr 20 2019 .cups
3333+lrwxr-xr-x 1 hauleth staff 39 Aug 21 2019 .curlrc
3434+lrwxr-xr-x 1 hauleth staff 43 Aug 21 2019 .dir_colors
3535+-rw-r--r-- 1 hauleth staff 2587 Sep 10 2019 .direnvrc
3636+drwxr-xr-x 6 hauleth staff 192 Apr 14 18:27 .docker
3737+drwx------ 14 hauleth staff 448 Oct 1 2019 .dropbox
3838+-r-------- 1 hauleth staff 20 Apr 1 2019 .erlang.cookie
3939+drwxr-xr-x 3 hauleth staff 96 Jul 1 2019 .gem
4040+-rw-r--r-- 1 hauleth staff 518 Mar 25 22:44 .gitconfig
4141+drwx------ 14 hauleth staff 448 Apr 15 22:03 .gnupg
4242+drwxr-xr-x 4 hauleth staff 128 Apr 2 2019 .hammerspoon
4343+drwxr-xr-x 5 hauleth staff 160 Apr 14 19:39 .hex
4444+drwx------ 3 hauleth staff 96 Apr 26 2019 .httpie
4545+-rw-r--r-- 1 hauleth staff 165 Feb 22 13:50 .jlassetregistry.json
4646+drwxr-xr-x 3 hauleth staff 96 Nov 29 22:13 .jssc
4747+drwxr-xr-x 9 hauleth staff 288 Feb 21 17:46 .julia
4848+drwx------ 14 hauleth staff 448 Oct 2 2019 .keychain
4949+drwxr-x--- 5 hauleth staff 160 Jan 24 12:20 .kube
5050+-rw------- 1 hauleth staff 720 Apr 15 16:29 .lesshst
5151+drwxr-x--- 3 root staff 96 Apr 3 2019 .lldb
5252+drwx------ 4 hauleth staff 128 Dec 18 14:16 .local
5353+drwxr-xr-x 8 hauleth staff 256 Mar 20 12:29 .mitmproxy
5454+drwxr-xr-x 18 hauleth staff 576 Apr 13 14:36 .mix
5555+-rw-r--r-- 1 hauleth staff 116 Apr 13 20:59 .nix-channels
5656+drwxr-xr-x 4 hauleth staff 128 Apr 14 13:47 .nix-defexpr
5757+lrwxr-xr-x 1 hauleth staff 46 Feb 1 22:13 .nix-profile
5858+drwxr-xr-x 3 hauleth staff 96 Sep 27 2019 .npm
5959+drwxr-xr-x 3 hauleth staff 96 Dec 19 14:05 .pex
6060+-rw-r--r-- 1 hauleth staff 183 May 2 2019 .profile
6161+drwxr-xr-x 5 hauleth staff 160 Mar 20 16:27 .proxyman
6262+drwxr-xr-x 2 hauleth staff 64 Feb 17 14:09 .proxyman-data
6363+-rw------- 1 hauleth staff 1391 Jan 22 11:46 .psql_history
6464+-rw------- 1 hauleth staff 1950 Feb 19 12:42 .python_history
6565+lrwxr-xr-x 1 hauleth staff 37 Aug 21 2019 .skhdrc
6666+drwx------ 11 hauleth staff 352 Oct 2 2019 .ssh
6767+drwxr-xr-x 4 hauleth staff 128 May 8 2019 .terraform.d
6868+drwxr-xr-x 4 hauleth staff 128 Dec 1 21:52 .thumbnails
6969+drwxr-xr-x 9 hauleth staff 288 Mar 9 17:14 .vagrant.d
7070+-rw------- 1 hauleth staff 11124 Apr 13 20:21 .viminfo
7171+lrwxr-xr-x 1 hauleth staff 37 Aug 21 2019 .vimrc
7272+drwx------ 4 hauleth staff 128 Nov 8 16:51 .w3m
7373+drwxr-xr-x 37 hauleth staff 1184 Apr 13 21:21 .weechat
7474+```
7575+7676+As you can see, there is bunch of them, some are linked to my dotfiles
7777+repository, but most are not. What is the problem there?
7878+7979+The spread.
8080+8181+All of the data is smeared between gazillion of different filed with different
8282+types of data. This causes headaches because:
8383+8484+- I cannot easily backup all the configuration as I need to check each file
8585+ independently to check if this is configuration file or it is data
8686+- I cannot exclude data from my backups in a uniform way. I need to check each
8787+ file independently and exclude it, remembering to do that for each new tool
8888+ that I add. Alternatively I can use whitelist instead of blacklist of paths
8989+ that I want to backup, but that pretty much defies the idea of having
9090+ automatic backup.
9191+- Cleaning up the old caches and data is troublesome as user need to review all
9292+ the folders and know what data they see mean.
9393+9494+But what We can do? Well, the macOS and Windows got it somewhat right, these
9595+OSes provide special paths for storing all configuration, caches, user-data,
9696+etc. in special, dedicated, and well known locations within user directories. It
9797+is like mentioned earlier FHS but for `$HOME`.
9898+9999+Unfortunately no other OS out there had:
100100+101101+1. Power to force developers to behave reasonably
102102+2. Standard to which developers should adhere to
103103+104104+Unfortunately the 1st point is still true, but the 2nd one is somewhat resolved
105105+in form of [XDG Base Directory Specification][xdg]. This is pretty short,
106106+simple, and straightforward spec where which data should go.
107107+108108+This makes life so much easier:
109109+110110+- Want to have backup your configuration? Just copy `$HOME/.config` where you
111111+ want.
112112+- Want to reset your configuration to base one? Just delete `$HOME/.config`.
113113+- Want to cleanup caches? Remove `$HOME/.cache`.
114114+- Etc.
115115+116116+It makes your `$HOME` much cleaner, much more manageable, much more like your
117117+place, where you are the ruler, not as a manager of the bulletin board or the
118118+storage house.
119119+120120+At one point I was even considering to have approach similar to [one taken by
121121+Graham Christensen][delete-your-darlings], but that would make my life even more
122122+miserable instead of forcing developers to fix their software.
123123+124124+Just in case, this is not only mine view on the state of configuration files,
125125+just see [old Google+ post by Rob Pike][pike] where he states exactly the same
126126+thing that FreeDesktop team try to address. I may not agree on all the concepts
127127+with Commander, but this one I vote all-fours.
128128+129129+For these who want to stop that madness and fix at least some software out there
130130+that is broken, you can check out [my script][xdg-please] that tries to fix
131131+(at least partially) non-conforming software.
132132+133133+---
134134+135135+**TL;DR**
136136+137137+Please, stop leaving your c\*\*p in my `$HOME` and call it "installation". If
138138+you want that, then I think you should find nearest Modern Art Gallery.
139139+140140+[fhs]: https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
141141+[xdg]: https://specifications.freedesktop.org/basedir-spec/latest/index.html
142142+[delete-your-darlings]: https://grahamc.com/blog/erase-your-darlings
143143+[pike]: https://web.archive.org/web/20180827160401/plus.google.com/+RobPikeTheHuman/posts/R58WgWwN9jp
144144+[xdg-please]: https://github.com/hauleth/xdg-rlz