Joshua's Docs - Notes on Dotfiles and portable config ecosystems

Resources

What & Link Type
ArchLinux Wiki: Dotfiles Intro and partial guide
"GitHub Does Dotfiles"
   - Utilities
Collection of helpful links to dotfile repos, tools, and more.
Anish Athalye (creator of dotbot): "Managing Your Dotfiles" Guide / Tutorial

It's not specific to dotfiles, but highly relevant is my bash cheatsheet

Dotfile Collections

If you are looking for a collection of dotfiles to get you started, here are some popular and/or well-documented ones:

And here are my dotfiles.

What are Dotfiles?

Historically, the term dotfiles refers to files that begin with . (a single dot) which are used to store configurations, command aliases, and settings. Files like:

  • .bashrc
  • .curlrc
  • .tmux.conf

The use of a leading . also makes these files easy to pattern match against

The term is now slightly misleading, as many configuration files no longer use this filename pattern, and it is common to now see configuration files in the form of config.json, config.yml, or other filename patterns that do not adhere to \.+.

Dotfile Conventions

If you look at a bunch of popular and well-maintained dotfile collections, you might start to notice certain patterns.

  • bootstrap.sh
    • Many collections contain a bootstrap script that handles the initial install and setup process for the collection. This is often included as ./boostrap.sh, or perhaps ./scripts/bootstrap.
  • /{program}
    • Many collections separate out aliases, settings, and scripts, by the program(s) they go with. So you might see a ./git/ directory, as well as ./node/, ./vscode/, etc.
  • /bin
    • Separate from organizing by program, some collections contain a /bin directory. This usually contains executable scripts, whereas the other files in the collection are aliases or configurations.

There are many more patterns and files than discussed here; the fun part of dotfiles is that you get to customize them to your exact liking! First and foremost, your dotfiles should be to improve your own DX :)

Dotfile Management

Version Control Your Dotfiles

Using version control, such as git, to manage your dotfiles is a common approach with many benefits. You get out-of-the-box:

  • Secure synchronization
  • Version history
  • Collaboration (if you let others fork or make PRs to your repo)
  • Dependency support (via submodules)
  • And more!

If you create a repository named dotfiles on GitHub, it can also be automatically pulled into new Codespaces.

The specifics of how to set this up are varied. Some users might take the bare repository approach, while other might use a setup script (commonly named bootstrap) that symlinks or copies the files. Or you can even use a pre-built solution for installing dotfiles, such as dotbot.

You can also involve symlinks in the process and something like GNU stow (see below for details).

Dotfile Utilities

As an alternative to using Version Control to manage your dotfiles, or perhaps to supplement it, there are many utility programs that can help with using dotfiles.

💡 dotfiles.github.io/utilities is a good starting spot for finding these utilities

One popular option for dotfile management is chezmoi, which also has a comparison table of different dotfile management solutions.

And don't forget about symlinks; you can always use symbolic links to keep your configuration files in a centralized location but have them be mapped to where they are expected without having to copy them. There are even tools like GNU stow, which can simplify the process and perhaps make it easier to use something like Dropbox for syncing.

Markdown Source Last Updated:
Fri May 03 2024 20:28:56 GMT+0000 (Coordinated Universal Time)
Markdown Source Created:
Sat Jul 31 2021 23:00:17 GMT+0000 (Coordinated Universal Time)
© 2024 Joshua Tzucker, Built with Gatsby
Feedback