1. 10
    How do you lay out your home directory? ask practices

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:

  • the standard OS folders (~/Music, ~/Documents, etc)
  • ~/.local/bin (in my $PATH), ~/.local/share, ~/tmp
  • ~/go (this feels particuarly ugly!)
  • ~/backups
  • ~/p (i.e. projects)
    • ~/p/code (personal projects, each directory in here is a repo)
    • ~/p/$employer (each directory under these is usually a repo)
    • ~/p/study (personal projects with the specific goal of study, e.g. tutorial notebooks, coursera materials)
  • ~/p/ref (reference materials, manuals, PDFs, etc.)
  • ~/p/talks

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?

  1. 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?

  2. 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.)

  3. To what extent do I fight my OS (which happens to be macOS) on things like ~/Documents, ~/Pictures?

  4. 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.

    1. 8

      I make $HOME read-only and then have only specific sub-directories like audio, 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.

    2. 10

      We had this question 5 months ago (with 54 comments):


      1. 1

        It feels like a particularly masturbatory “question”.

    3. 4
      • ~/bin
      • ~/Documents
        • travelreceipts
        • papers
        • talks
      • ~/Notes
      • ~/mail
      • ~/Pictures
      • ~/tmp
      • ~/Git
        • PKGBUILD
        • devops
        • projects
          • sites
          • $ProjectLanguages

      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 ugly elaborate backup system which utilizes snapper and borg. I essentially just do systemctl 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

    4. 3
      • ~/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 RT2600ac
        • bin/ -> scripts for managing the ~/exthdsync/ directory
        • config/ -> 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 like music/ (managed via MusicBrainz Picard, books/ (managed via Calibre) and pictures/ (manually managed, sub-folder per year, then “YYYY-MM-DD Description” folders)
        • personal/ -> Personal stuff
          • appdata/ -> probably misnamed, contains subfolders for finance, housing related stuff, mails/ folder with all my mails, …
          • repos/ -> sub-folders are Git repositories of my projects
          • One subfolder per education institution
    5. 2

      I haven’t invested too heavily into my setup but it’s generally something like this

      • Standard folders
      • ~/Code [An alias, ws for workspace, takes me here instantly]
      • ~/dotfiles [Using GNU Stow (stow) lets me symlink any folders here to their respective root locations]
      • ~/Dropbox [Generally any notes now that I’m starting to use org mode + PDFs etc]

      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.

    6. 2

      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…

    7. 2

      ~/src for hacking, ~/stl for 3d printing, and ~/rpg for role-playing games.

    8. 2

      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 (besides Downloads): 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.

    9. 1

      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.

      ~/bin/ - for any scripts I write and use, and especially for wrapper scripts to fix things I don't like
      ~/mnt/ - for `sudo mount /dev/sdb ~/mnt/`
      ~/opt/ - for software and tools that might need compiled (like ~/opt/dwm, ~/opt/Write, ~/opt/yEd)
      ~/share/ - for writings or drawings that I create (like ~/share/documents/*.svg, produced by Write)
      ~/src/ - for any project I work on (every directory here is a git repo)
      ~/src/*_paper/ - for research papers I'm working on
      ~/src/tmp/ - for any projects that I don't intend to commit to git (like re-clones of my work projects for trying new things)
      ~/tmp/ - for any files I download
      ~/tmp/*/ - for any completely throwaway projects (e.g. ffmpeg scripts for making hour long sleep videos)
      ~/etc/ - for any configuration files for tools I use

      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.

      ~/src/github.com/$owner/$repo - for any GitHub projects cloned
      ~/src/bitbucket.org/$owner/$repo - for any BitBucket projects cloned
      ~/src/$repo -> ~/src/github.com/$owner/$repo - symlinks for easier access to the full path

      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.

    10. 1
      • ~/.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 syncthing
      • assorted dotfiles I don’t control and don’t fight
        • The important ones are included in my home dir git repo
        • The unimportant ones are ignored from git
      • assorted OS default directories I don’t control and don’t usually fight
        • I do use ~/Downloads but I symlink it is ~/downloads too
        • I don’t use the macos ones mostly ~/Photos ~/Music etc
      • My home directory is a git repo. Details on my setup are on my github
    11. 1
      backup  -> backups and stuff
      code    -> coding projects, both mine and others
      doc     -> documents and papers (usually life meta)
      desk    -> desktop dumping ground
      dl      -> download dumping ground
      go      -> $GOPATH
      keybase -> keybase folders
      music   -> the little music i do store locally
      prefix  -> the unpackagable
      project -> project files (not code)
      tmp     -> temporary dumping ground, home of unix sockets
    12. 1

      My Linux system at home:

      • ~/JAIL - for installing libraries and programs that I don’t want system wide.
      • ~/JAIL2 - for when stuff would conflict with stuff in JAIL
      • ~/apps - applications that are compiled from tarballs
      • ~/archive - said tarballs
      • ~/bin
      • ~/docs
      • ~/images - used long before Pictures became a thing
      • ~/projects - source code I’ve written
      • ~/public_gemini
      • ~/public_gopher
      • ~/public_html
      • ~/repo - applications that are downloaded from github (mostly)
      • ~/source - source code I’ve written
      • ~/sundaygame - notes for my D&D campaign
      • ~/writings - stuff I’ve written
        • nano - directories for NaNoGenMo
        • journal - notes for my blog
          • entries - notes about a thousand different topics

      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.

    13. 1

      I don’t have much top directories:

      • code (for cloning project sources)
      • data (for non recreatable data and mountpoints)
        • videos
        • pictures
        • isos
        • notes
        • onedrive (mounted via rclone)
        • sharepoint (mounted via rclone)
      • tmp (mounted tmpfs)
      • drist.d (modules for drist, a config manager)

      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.

    14. 1
      ./  ../  bin@  .cshrc@  etc/  lib/  mail/  prog/  tmp/  usr/

      I’ve been rearranging again recently.

      • bin is a link to lib/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 chose lib because that’s what Plan 9 did.
      • mail/ holds some mbox files, and a directory of queued messages. I keep meaning to move it into usr/ as currently I copy both mail and usr 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 subdirectory projects/ which holds individual projects, programming or otherwise. I don’t sort by language subdirectories as I never found that particularly helpful. A subdirectory texts/ holds pdfs, epubs, textfiles and the like tentatively sorted according to the Dewey system. A school directory holds essays and old notes - now I mostly take notes entirely off-computer. The music/ and pictures/ directories are also here.
    15. 1

      Here’s what tree -dL 1 looks like at $HOME

      ├── downloads
      ├── bin    // local bin folder
      ├── books  // pdfs, ebooks, docs
      ├── build  // Build folder for external projects
      ├── docs   // Documents
      ├── music
      ├── org    // personal org files
      ├── proj   // personal code projects

      It’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)

    16. 1

      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.

    17. 1

      As an unemployed student:

      • .config/
      • .cache/
      • .dotfiles/
        • .git/
        • [various packages managed by GNU stow]
      • Documents/
        • Backups/
          • yyyy-mm-dd-description.tar.zst.age
        • Development/
          • Hardware/
          • Projects/ # Large scale, multi-subproject “Projects”
          • Miscellaneous/
          • Web/
      • Music/
      • Screenshots/
        • yyyy/
          • mm/
            • dd/
              • hh-mm-ss(-n).png
      • Videos/
        • Projects/
        • Recordings/
        • Movies/
          • Subtitles/

      Backups are manual: I copy the target folder, throw it in a tar, compress the tarball with zstandard, and encrypt it with a passphrase using age. It wouldn’t be hard to throw this workflow into cron though.

    18. 1

      Besides the ‘normal’ folders (Desktop, Documents, Pictures), I have:

      • ~/bin
      • ~/work
      • ~/temp
      • ~/repos

      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.

    19. 1

      The $HOME dir layout I prefer (not my blog): https://morr.cc/home-sweet-home/

    20. 1
      • .config/ # $XDG_CONFIG_HOME, most config files, https://wiki.archlinux.org/index.php/XDG_Base_Directory for tips
      • annex/ # git-annex
      • bin/ # in $PATH
      • doc/ # most stuff that isn’t in src/
      • Mail/ # offlineimap syncs mail here
      • old/ # backups from old installation, chipping away at it one bit at a time
      • pkg/ # GOPATH=$HOME
      • src/ # not just go projects, but GOPATH=$HOME
      • sshfs/ # afuse can automount stuff here
      • tmp/ # temporary files
      • var/ # not quite so temporary files
      • .session.d/ # xsession snippets, should move to ~/.config
      • .git/ # I have $HOME in a git repository, and lots of stuff in ~/.gitignore
      • .local/bin # is in $PATH also
    21. 1
      • bin/ => scripts
      • etc/ => dotfiles, symlinks managed with https://git.qtp2t.club/hazel/lake [wip]
      • src/ => code that is mine or isn’t mine but i work with often
      • tmp/ => downloads
      • usr/doc/ => documents
      • usr/games/ => take a wild guess
      • usr/img/ => self-explanatory
      • usr/music/ => still self-explanatory
      • usr/video/ => yeah
      • var/build/ => stuff that isn’t my code but i need to compile
      • var/certs/ => certificates
      • var/mail/ => maildir, managed by mbsync
      • var/packages/ => clone of https://github.com/void-linux/void-packages, on a cronjob to fetch every day
      • var/queue/ => nq: https://github.com/leahneukirchen/nq
      • var/rtorrent/ => yeah
      • var/service/ => runit service files: alias svu=“SVDIR=~/var/service sv”
      • var/vbox/ => yeah
      • wpilib/ => hardcoded non-XDG non-dotfile path for a Java library

      …and a LOT of dotfile pollution in ls -a, but I don’t really care

    22. 1
      • bin - 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 $GOPATH
        • code/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 internet
      • Sync for the Syncthing directory
      • the usual stuff: desktop, docs, music, pics, video (yes, I edit ~/.config/user-dirs.dirs to get the shorter lower-case names)
      • oh, I’ve just noticed snap in my home directory.
      • a bunch of hidden directories, some of them more interesting than others: .local, .config, .cabal, .cargo, .hoogle, .rustup, .sbt, .stack, .VirtualBox and others.