Home directory hierarchy

Let me start by telling you that I'm somewhat obsessed about standards and good practices in pretty much everything I do. Sometimes it can be really sick to the point it hinders the normal flow of whatever I'm trying to improve instead of helping me out which is really a shame, nonetheless it usually pays out on the long term once I've established a path that suits me.

Choosing the optimal hierarchy within your home directory may seem like a trivial thing to do but once you really delve deep into this topic you may be surprised. Sane people usually solve this problem rather quickly, that is they have no structure at all and are happily throwing every file into $HOME or $HOME/Desktop. This strategy saves you time in the beginning but progressively turns into a chaotic mess as you get more and more files all mixed up. I personally find it wiser to loose sometime before than having to periodically sort everything afterwards.

So this is what my home directory looks like right now:

[vasco@anakin ~]$ ls
app bak bin doc dos media pkg rrd src tmp

The first thing you probably have noticed is another obsession from which I suffer, using a three letter naming scheme for each top level directory. While I really love long naming schemes like CamelCase when coding Java for instance I think directory names should be short so that they fit perfectly in whichever application displays them. Moreover, there are already a lot of standard directory names composed of only three letters particularly so in the Unix world. Unfortunately I dislike med to refer to my media so that's the only exception, actually media is a symbolic link to a shared partition where all the media goes, unless it's something private obviously. Hopefully you've already figured out the basic logic behind my $HOME but I will now explain the rationale behind each directory name in the following paragraph.

The app directory hosts every application which I install locally for my user only, often when compiling something with ./configure --prefix=/$HOME/app/something. Under app there is another directory for each application. The bak directory holds private backups like conf files, logs or even wget/httrack produced website mirrors. The bin directory has some binaries and bash, perl or python scripts which I usually run on the console calling them directly since bin is in my path variable. The doc directory should be quite obvious, it's used for private documents I don't want to share and can further contain sub directories like ebooks, music, pictures and videos. The dos directory contains a sort of MS-DOS file system inside with old games which I play in dosbox. The media directory as I've already mentioned is a symbolic link to a shared partition resembling the doc structure. The pkg directory helps me organize the packages I maintain for the Arch Linux community repository and contains the sub directories anakin, pkgbuilds and sources. The rrd directory holds my local rrdtool stuff, namely neat graphics of several system and network parameters. The src directory obviously enough has all my source code which is normally further organized into distinct project sub directories or generic ones like bash, perl, python, java and the like. The tmp directory is where I throw temporary stuff like tar.gz archives or documents before I take some time to organize them, whereas some people put this kind of junk one level up, that is $HOME itself.

Though it's not a perfect setup I strive to keep the right balance between having no organization at all and creating an excessively large hierarchy many levels deep and with lots of directories in each node.

Filesystem Hierarchy Standard