How I organize my home directory

Computer organization system documentation

In 2010 I wrote an article How I organize my digital documents. A lot has changed in the way I organize computer files since then. I switched to a GNOME-based desktop environment (with Fedora), which follows freedesktop.org standard folder names (Documents, Pictures, and so on). I also accumulated an whole decade of pictures, documents and processes.

I want to share the results of my learning and experimenting process as of today.

Table of Contents

Backups

Backups are an integral part of my organization system. I use the following code to indicate the backup strategy for each directory:

(Borgmatic) : Backed up with Borgmatic
(Nextcloud) : Synchronized with Nextcloud
(Not backed up) : Not backed up

I have two main types of backup systems. Documents and Pictures are synchronized with Nextcloud. Everything else (including system files, configuration, code repositories) is backed up with Borgmatic.

  1. Nextcloud (Nextcloud)
    • My Nextcloud setup is described in Nextcloud self-hosted architecture.
    • Directories are continuously synced using the Nextcloud client.
    • Nextcloud VM itself has automatic ZFS snapshots.
    • Snapshots can be replicated to a remote TrueNAS server.
  2. Borgmatic (Borgmatic)
    • Borg repositories live on a ZFS dataset which is replicated remotely to an offsite TrueNAS server.
    • Borgmatic does a full system backup of everything on my laptop.
    • Daily job runs at 7pm.
    • Excluded files:
      • Cache and tmp directories
      • Directories synced with Nextcloud
      • ~/Downloads

Remote-only archive directories

Most of the data on my Nextcloud server are files I rarely access. I don’t need to keep a synchronized copy on my laptop. In the Nextcloud client settings, you can de-select directories you do not want to synchronize to your computer.

I select archives and project directories for organizations I am still actively involved with. For some never ending projects (Personnal archive, for example), I synchronize the last 3 or 4 yearly subdirectories.

When you un-check a box, you get this confirmation dialog explaining that the local copy will be removed:

I have over 450 GB of data on my Nextcloud server. Only about 165 GB is synchronized to my laptop. Remote-only files can be accessed via the web client or the WebDAV mount.

$CDPATH

Since I use a GNOME based system, directory names are long, capitalized and contain spaces. This can make it tedious to type when working on the command line.

Setting the CDPATH environment variable with paths to project directories can make your life much easier.

From the bash manpage:

  CDPATH The search path for the cd command.
         This is a colon-separated list of directories
         in which the shell looks for destination directories
         specified by the cd command.
         A sample value is ".:~:/usr".

My current CDPATH contains project and code directories:

. /home/alex /home/alex/Code /home/alex/Code/Personal /home/alex/Code/Grafana /home/alex/Documents/Projets /home/alex/Documents/Projets Grafana Labs

Tab autocompletion works for CDPATH subdirectories. I also use the Fish shell. It has very powerful autosuggestions which further reduces the required typing.

Overview of my user file system hierarchy

Here’s an overview of my home directory, limited to a depth of two directories.

/home/alex
      ├── Backups (Nextcloud)
      │   ├── Firefox bookmarks
      │   ├── Evolution
      │   ├── Flameshot
      │   ├── PGP
      │   ├── Printer settings
      │   ├── pfSense
      │   ├── TrueNAS
      │   └── Unifi Controller
      ├── Code (Borgmatic)
      │   ├── External
      │   ├── Grafana
      │   └── Personal
      ├── Documents (Nextcloud)
      │   ├── Archive Amis
      │   ├── Archive Art
      │   ├── Archive Grafana Labs
      │   ├── Archive Personnel
      │   ├── Archive Toastmasters
      │   ├── Archive Transactionnel
      │   ├── Archive Turba
      │   ├── Blog files
      │   ├── Clients Grafana Labs
      │   ├── Org
      │   ├── Outbox
      │   ├── Projets
      │   ├── Projets Grafana Labs
      │   ├── Références externes
      │   ├── Références personnelles
      │   └── Zotero
      ├── Downloads (Not backed up)
      ├── Inbox (Nextcloud)
      │   ├── Cell phone camera
      │   ├── Cell phone documents
      │   ├── Cell phone downloads
      │   ├── Cell phone movies
      │   ├── Cell phone pictures
      │   ├── Nikon D5600
      │   └── Screenshots
      ├── Pictures (Nextcloud)
      │   ├── Aquarelle
      │   ├── Archive Grafana Labs
      │   ├── Archive Parkour
      │   ├── Archive Personnel
      │   ├── Collections
      │   ├── Dessin
      │   ├── Instagram
      │   ├── Inventions
      │   └── Références
      ├── Programs (Borgmatic)
      └── Public (Not backed up)

Details of each top-level directory

~/Backups (Nextcloud)

4 GB, synced on Nextcloud.

This is not a standard freedesktop.org directory, I created it myself.

In this directory, I save backups of configuration files from various programs, appliances and systems. I download a backup after making changes and before software upgrades in case I need to rollback.

This is not my automated full system backup. This is just a place for saving manually downloaded backups. This directory tree enters my backup flow via Nextcloud files synchronization.

Examples of manually downloaded backups:

  • Wordpress sites that I manage for friends.
  • Exported software configuration and user data.
  • Network appliance configurations.
    For example: TrueNAS, pfSense, Unifi Controller.
  • Some open-source systems for which the backup API is an Enterprise feature.
  • Encryption/decryption keys for some LUKS containers.
  • PGP secret keys.
  • Tab Session Manager can backup sessions in JSON format to a directory, but it must be a subdirectory of ~/Downloads. I created a symlink from ~/Downloads/Tab Session Manager backups to ~/Backups/Tab Session Manager. See also: How I organize my Firefox tabs § Backing up tab sessions

~/Code (Borgmatic)

9.8 GB, mostly repositories under version control.

I don’t think Git or other version control systems are a good backup strategy. I often have local branches that are not pushed to the remote repositories. My Code directory is backed up with Borgmatic to catch any un-pushed commits that are only present locally.

There are three subdirectories.

  1. ~/Code/External
    • Code written and maintained by other people.
    • OSS projects I want to inspect or contribute on.
  2. ~/Code/Grafana (my employer)
    • Work related code repositories.
  3. ~/Code/Personal
    • Personal programming project.
    • Forks of open-source projects I contributed to.
    • Beancount (my plaintext accounting ledger and import scripts)
    • My blog
    • My dotfiles
    • Playbooks and deployments for self-hosted infrastructure and services

~/Documents (Nextcloud)

30 GB, synchronized with Nextcloud. 106 GB total on Nextcloud.

There are three main kinds of directories.

  1. Archives
    • The organization structure is similar to ~/Pictures.
    • One archive for each major classification (art, work, personal projects, organizations I have been a part of).
    • Contains finished projects directories, reference material.
    • Only a few recent years are synchronized with Nextcloud.
    • Older years are archived on Nextcloud and accessed remotely via a WebDAV mount or the web client.
  2. “Working” directories.
    • Blog files
    • Org mode files
    • Outbox
    • Active projects
  3. References library
    • Ebooks
    • Procedures and checklists
    • Zotero database
~/Documents
  ├── Archive Amis
  │   │   # Occasional collaborations go in yearly archives.
  │   ├── 2019
  │   ├── 2020
  │   │   ├── 2020-06-03 Robert pictures scan
  │   │   └── 2020-06-08 John photoshoot water front
  │   └── <Friend's name>
  │         # Ongoing collaborations have 2nd level directories.
  ├── Archive Art
  │   ├── 2019
  │   └── 2020
  │       ├── 2020-11-15.Montréal.some_photoshoot
  │       └── 2020-12-07.Montréal.another_project
  ├── Archive Grafana Labs
  │   ├── Contracts
  │   ├── Praise
  │   ├── Projects
  │   │     # Only job related personal projects.
  │   │     # Most work project documents and files
  │   │     # are saved in corporate intranet.
  │   └── Invoices for professional services
  ├── Archive Personnel
  │   ├── 2019
  │   └── 2020
  │       ├── 2021-03-18 freenas-backup disk replacement
  │       ├── 2021-04-30 TST background
  │       └── 2021-05-13 vaccin COVID-19
  ├── Archive Psychologue
  │   # Therapist invoices, exercises, shared files.
  ├── Archive Toastmasters
  ├── Archive Transactionnel
  ├── Archive Turba
  ├── Blog files
  ├── Clients Grafana Labs
  ├── Org
  │   ├── épicerie.org    # My groceries list, synced to my phone with Orgzly
  │   ├── grafana.org     # Work notes
  │   ├── personnel.org   # Personal
  │   └── sysadmin.org
  ├── Outbox
  ├── Projets
  │   ├── 2021-06-26 post food-storage-system
  │   │   # Writing material for a blog post
  │   └── 2021-08-05 Netgate support request
  ├── Projets Grafana Labs
  ├── Références externes
  ├── Références personnelles
  └── Zotero

There are several kinds of documents file systems grouped together under ~/Documents:

Archive amis
Work I do for or in collaboration with friends. Ongoing collaborations have their own 2nd level directories. When I haven’t had an interaction in a long time, I might move friends directory under the year of the last interaction.
Archive art
Documentation of art pieces and invention. It has pictures, original documents, projects material.
Archive Grafana Labs/Toastmasters/Turba/etc.
Companies and organization I am affiliated with get their own archive directory.
Archive personnel
Personal projects, research, chores, transactions. Anything that is personal and project or time related.
Blog files
Images related to blog posts are committed in Git. To avoid bloating my blog’s Git repository with large files, I serve them on a separate virtual server. I leverage Nextcloud sync and filesystem snapshots provided for the parent ~/Documents directory instead of Git for version history.
Outbox
Files to send to people or to upload to a system. Documents exported in PDF, compressed archives, edited pictures. I usually keep a local copy of files I send out. This is similar to my ~/Pictures/Exports directory.
Projets
Active project directories. Finished projects are moved under Archive directories.
Références externes
External references. Ebooks mostly.
Références personelles
Personal references. Medical, CV, procedures, checklists, history home addresses.
System data: Org/, Zotero/
Reference files that are modified using an application with a user interface. Org is for all my org-mode files. Zotero is my bibliographic references database.
Org/grafana.org
Work notes.
Org/personnel.org
Personal notes. History of employment and living addresses. Medical history. Relationships history.
Org/sysadmin.org
Systems administration reference notes for my laptop, servers, smart phone, and cloud services.
Org/épicerie.org
My groceries list, synchronized to my phone with Orgzly. When I need to buy an item, I toggle its status to ‘TODO’. When I do groceries, I open a saved search that shows me all the items that are ‘TODO’. When I put items in my shopping cart, I toggle their status back to ‘DONE’.

~/Downloads (Not backed up)

0 to 100s GB, not backed up.

The default directory for saving files downloaded from the internet.

~/Inbox (Nextcloud)

0 to 2 GB, synchronized with Nextcloud.

This directory is set up to capture files from my phone and other devices.

I use Syncthing to get 2-way synchronization between my phone and ~/Inbox subdirectories on my laptop. Those files are then synchronized to the Nextcloud server with the Nextcloud client app on my laptop. See details in Synchronizing files across phone, laptop and NAS with Nextcloud and Syncthing.

There are a few subfolders here:

~/Inbox
  ├── Cell phone camera      # Syncthing folder /DCIM on my phone.
  ├── Cell phone documents   # Syncthing folder /Documents on my phone.
  ├── Cell phone downloads   # Syncthing folder /Download on my phone.
  ├── Cell phone movies      # Syncthing folder /Movies on my phone.
  ├── Cell phone pictures    # Syncthing folder /Pictures on my phone.
  ├── Nikon D5600            # I use this directory when importing pictures via USB.
  └── Screenshots            # Screenshots taken with Flameshot on my laptop.

This directory structure is processed like a GTD inbox of “stuff”. When I process my inboxes, I move files to the following kinds of target directories: trash, projects or references.

~/Pictures (Nextcloud)

22 GB, synchronized with Nextcloud. 76 GB total on Nextcloud.

I highly recommend looking into OrganizePictures.com. It’s a simple and complete system for organizing digital photos.

~/Pictures
  ├── Aquarelle
  ├── Archive Grafana Labs
  │   │   # Pictures of people I work with, events, trips.
  │   ├── 2018-10-01 New York head office
  │   └── 2019-10 Berlin
  ├── Archive Parkour
  ├── Archive Personnel
  │   ├── 2019
  │   ├── 2020
  │   └── 2021
  │       ├── 2021-04-24.Alfred-Kelly_Nature_Reserve.Randonnée_avec_Riya
  │       └── 2021-06-20.Lac_Pink_Parc_Gatineau.Randonnée_avec_la_famille
  ├── Collections
  │   ├── Logos
  │   ├── Inventions
  │   ├── Montreal street shots
  │   ├── Portraits
  │   └── Etc.
  ├── Dessin
  ├── Exports
  │   └── Instragram
  │       ├── Posted
  │       └── Ready to post
  └── Références

Pictures are organized into general categories (workplace, parkour, personal life), then by year, then by event.

~/Programs (Borgmatic)

600 MB, backed up with Borgmatic.

These are scripts and executable binary files that I want in my PATH.

~/Public (Not backed up)

~2GB, not backed up.

This directory exists by default on most freedesktop.org compliant systems. I usually store volume images and other free software assets that I might need repetitively. Files that would be safe and useful to share if I chose to enable a sharing service. They are usually quite large and can be re-downloaded easily.

Future writing ideas

I might write a detailed description of my Borg+Borgmatic setup for automatic backups.

Alexandre de Verteuil
Alexandre de Verteuil
Senior Solutions Architect

I teach people how to see the matrix metrics.
Monkeys and sunsets make me happy.

Related