I’m migrating to a new laptop and am taking the opportunity to rethink how I lay out my home directory. I’d love to hear how people are doing this in 2020. What does your home directory look like? (This question reminds me of this tweet.)
Right now I have:
What about you?
Here are some examples of the things I’m thinking about. These are just examples! I’m interested in unknown unknowns too! What else should I be optimizing for?
Where do I put stuff I don’t want to backup, e.g. build artifacts, docker images, virtual environments, node_modules, etc. Do I put these in their customary location (often alongside the code) and blacklist (potentially a lot of fragile) paths and patterns, or do I put them all in a single place I can blacklist with a single pattern in my backup software? This has been a particular pain point for me. Would it be practical to change how I backup so I can just naively back up everything and forget about his?
Have there been any tooling improvements that make it easier to care less about layout in the same way gmail made many of us no longer care about filing emails (e.g. search, command line navigation, etc.)
To what extent do I fight my OS (which happens to be macOS) on things like ~/Documents, ~/Pictures?
Where do things like Dropbox, iCloud, etc. fit in (I don’t use either of these seriously, and I don’t trust iCloud at all), but they’re occasionally useful.
I make
$HOME
read-only and then have only specific sub-directories likeaudio
,docs
,apps
,code
etc.Dot files follow XDG spec, except a few applications that have been grand-fathered in, and I’m working on replacing/fixing them.
We had this question 5 months ago (with 54 comments):
https://lobste.rs/s/zpw6py/how_do_you_organize_your_home_directory
It feels like a particularly masturbatory “question”.
My structure is not very well thought out honestly. It’s just accumulated cruft because of habits. I have also spent a good amount of time cleaning up
~/
so there are only 28 files there!I also have a very
uglyelaborate backup system which utilizessnapper
andborg
. I essentially just dosystemctl enable backup@$snapperConfig
and everything is sorted for whatever I’m deciding to snapshot+backup. It also currently sports a very specific exclude file because software is terrible, it’s not exhaustive but it covers a nice portion GB of data I do not care about.https://github.com/Foxboron/home/blob/master/.config/borg/exclude https://github.com/Foxboron/PKGBUILDS/blob/master/foxboron-system/backup-backup https://github.com/Foxboron/PKGBUILDS/blob/master/foxboron-system/snapper-home
~/bin/
-> Some small apps like syncthing, fossil, … and a bunch of personal shell scripts~/Desktop/
-> Don’t really need that but the OS (Linux with KDE) has it and its good for a quick and dirty place to store short lived files like TODO notes because I will see those on my desktop~/Downloads/
-> big pile of downloaded files, cleaned out regularly (manually)~/exthdsync/
-> This is where all the important data lives. Gets backuped with borg to a remote server and rsynced locally to a Synology RT2600acbin/
-> scripts for managing the~/exthdsync/
directoryconfig/
-> This is where all the configuration files under~/config
are linked to that are important. Managed with GNU Stow. Eg.~/config/.emacs
is a symlink to~/exthdsync/config/.emacs
multimedia/
-> Multimedia files, sub-folder likemusic/
(managed via MusicBrainz Picard,books/
(managed via Calibre) andpictures/
(manually managed, sub-folder per year, then “YYYY-MM-DD Description” folders)personal/
-> Personal stuffappdata/
-> probably misnamed, contains subfolders for finance, housing related stuff,mails/
folder with all my mails, …repos/
-> sub-folders are Git repositories of my projectsI haven’t invested too heavily into my setup but it’s generally something like this
ws
for workspace, takes me here instantly]stow
) lets me symlink any folders here to their respective root locations]Nothing particularly out of the ordinary besides that. I leave things like node_modules, virtualenvs and whatever in their respective folders and never try to back them up with something like Dropbox (since you mentioned blacklisting with backup software)
I’m trying to make better use of search first for most everything I use but I’m not quite there with my files at all.
I humbly ask
home-manager
to sort this rats nest out for me… then I make a “repos” folder and an “experiments” folder and get on with things…~/src
for hacking,~/stl
for 3d printing, and~/rpg
for role-playing games.I think I’m not much different from what other people have written, although I do fight my OS about Desktop, Music, etc., except Downloads, I’ve given up on that. So
Downloads
remains and I have the evergreens other people have:bin
,projects
, etc. For wildcards I have (besidesDownloads
):dump
.One thing I do have to offer is syncing services. I have been trying out a couple after starting with Dropbox years ago and I don’t fight them, since some are not very flexible about where they want their folder to be. Instead I have
sync
in my home folder which I symlink to whatever service I’m currently using. It makes it easy to switch without having to update scripts and other stuff.I’ve spent a long time finalizing my home directory. I use a variation of the FHS for all my local files, though it took a while to really appreciate and make the most out of it.
Every time I reinstall my OS, I go through the same process of removing all the Documents, Pictures, Downloads, etc directories and create the ones I prefer. Most of them stay gone, but Desktop and Downloads often come back. The biggest perpetrators are Gnome and Chrome, respectively, but this is solved with a few settings that I always have to look up.
I want to use the
$XDG_CONFIG_HOME
and$XDG_DATA_HOME
directories but I never spend enough time making sure it all works, so I don’t really trust them to work right. I also just don’t like the idea of hiding config files in a hidden directory.One thing I used to do that I no longer do is to keep a very organized
~/src/
directory. I had a script to clone every project into an exact path and then update symlinks to be easier to use. The trouble I ran into is that it was a little too regimented and didn’t make it easy to write throwaway code because I always had to create a GitHub repository when I wanted to work on a project.I also try to have a small home directory as most of my work is on limited drives, so I need a solution to managing large datasets. The trick I use there is to make heavy use of symlinks to a data drive. For example, a project
~/src/foo
would have~/src/foo/data
pointing to/mnt/mylargedrive/foo/data
and~/src/foo/gen
would point to/mnt/mylargedrive/foo/gen
. Then I can document the data source and formats in a/mnt/mylargedrive/foo/README
and everything stays nice and clean.~/.config
most of my dotfiles stuff~/archive
holds one directory per year with stuff I want to keep archived but am not actively using~/bin
in my PATH. Holds custom scripts with no filename extensions~/books
PDFs of books~/clients
client work~/music
mp3s~/screens
screenshots get dropped here with timestamp and description in the filename~/voice-memos
syncs audio recordings from my phone voice memo app via syncthingMy Linux system at home:
There isn’t a real difference between the projects and source directories if I’m honest, but it seemed (and still does) like a good idea. For backups, I use
rsync
with a list of files to be excluded (stuff like*.o
,*~
etc.and even certain directories). It works for me.I don’t have much top directories:
I also rely heavily on ~/.local for custom software installation (with a simple custom package manager), and ~/.cache for holding data that can be regenerated (eg. offline IMAP sync, custom port tree).
As for backups, I simple use
tar -c
on my whole$HOME
(stopping at mountpoints) and deduplicate the data using dedup in a local repo lying in/var/dedup/$HOSTNAME
. This encrypted/compressed repo is sync’d remotely using rclone to my company onedrive. For my personnal backups, I am working on using backblaze to host my dedup repo. Config files of servers are backed up using tarsnap.I’ve been rearranging again recently.
bin
is a link tolib/bin/
which holds a bunch of little scripts..cshrc
is my shell configuration file - I’d rather this wasn’t there, but can’t find a good way for it not to be (previously I had.profile
here, this now has the same purpose).etc/
is for program source if I download it, git repositories and so on.lib/
is my$XDG_CONFIG_HOME
- I like it visible and choselib
because that’s what Plan 9 did.mail/
holds some mbox files, and a directory of queued messages. I keep meaning to move it intousr/
as currently I copy bothmail
andusr
to a USB when reinstalling an OS or switching computers.prog/
is a joint$XDG_CACHE_HOME
and$XDG_DATA_HOME
, as I don’t think I’ve ever had a problem with either being removed.tmp/
is my download directory, and also set as desktop, but I don’t use a window manager that has icons so I don’t get to see that.usr/
is stuff about me. There’s a subdirectoryprojects/
which holds individual projects, programming or otherwise. I don’t sort by language subdirectories as I never found that particularly helpful. A subdirectorytexts/
holds pdfs, epubs, textfiles and the like tentatively sorted according to the Dewey system. Aschool
directory holds essays and old notes - now I mostly take notes entirely off-computer. Themusic/
andpictures/
directories are also here.Here’s what
tree -dL 1
looks like at $HOMEIt’s actually a lot less clean than this, but this is what it’s supposed to look like (plus $WORK folder which I keep separate from
proj
)I have my dot files synced via iCloud Drive, including a script I wrote to re-populate symlinks on a new machine, and convert newly created dot files (e.g. for a new tool I start using) by moving + symlinking.
The above tool also sets up a hidden
~/bin
symlink which also goes back to a dir in the iCloud based dot files dir, for small utility shell scripts (i.e. the dot file script itself, a script to connect/disconnect an SSH socks proxy and set the appropriate system pref so the proxy is used, etc)Besides that, my home folder is mostly just “as intended” - photos, documents etc.
Project work (i.e. mostly code, but some documentation etc as well) I have on an external M2 SSD. I can thus unplug it, move to my laptop (or a new Mac), plug it in and my work is all there. Combined with the iCloud sync’d dot files, it makes setting up a new machine (either new hardware, or after a clean OS install) quite simple - install apps, run a script, plug in the SSD.
As an unemployed student:
Backups are manual: I copy the target folder, throw it in a
tar
, compress the tarball with zstandard, and encrypt it with a passphrase usingage
. It wouldn’t be hard to throw this workflow intocron
though.Besides the ‘normal’ folders (Desktop, Documents, Pictures), I have:
And I put stuff in ~, ~/temp, ~/Desktop. Additionally, I have a external harddrive laying around with a projects folder where I have a lot of stuff. I also have various folders named ‘documents’, ‘BACKUP’, ‘old’, ‘old phone’ and ‘to sort’ on external harddrives or USB sticks. Then I have things on various accounts on google drive and dropbox, and some posts I’m working on on stackedit.io. It’s a mess, really.
The $HOME dir layout I prefer (not my blog): https://morr.cc/home-sweet-home/
bin/
=> scriptsetc/
=> dotfiles, symlinks managed with https://git.qtp2t.club/hazel/lake [wip]src/
=> code that is mine or isn’t mine but i work with oftentmp/
=> downloadsusr/doc/
=> documentsusr/games/
=> take a wild guessusr/img/
=> self-explanatoryusr/music/
=> still self-explanatoryusr/video/
=> yeahvar/build/
=> stuff that isn’t my code but i need to compilevar/certs/
=> certificatesvar/mail/
=> maildir, managed by mbsyncvar/packages/
=> clone of https://github.com/void-linux/void-packages, on a cronjob to fetch every dayvar/queue/
=> nq: https://github.com/leahneukirchen/nqvar/rtorrent/
=> yeahvar/service/
=> runit service files: alias svu=“SVDIR=~/var/service sv”var/vbox/
=> yeahwpilib/
=> hardcoded non-XDG non-dotfile path for a Java library…and a LOT of dotfile pollution in
ls -a
, but I don’t really carebin
- a place to put scripts and dump .iso files and some installations like IntelliJ. Maybe it should be a symlink to.local/bin
.code
- contains my projects at the top level, also:code/go
- my $GOPATHcode/src
- cloned git repositories, mostly from github, roughly organized by topic (lang
,os
,sys
,util
, etc)downloads
as a messy dumping ground for files from the internetSync
for the Syncthing directorydesktop
,docs
,music
,pics
,video
(yes, I edit~/.config/user-dirs.dirs
to get the shorter lower-case names)snap
in my home directory..local
,.config
,.cabal
,.cargo
,.hoogle
,.rustup
,.sbt
,.stack
,.VirtualBox
and others.