Trevor D. Miller

moon indicating dark mode
sun indicating light mode

Organizing tooling settings using dotfiles

October 29, 2019

What dotfiles are used for

Dotfiles are a file that has a filename that is usually prefixed with a dot (period) like .gitconfig and .vimrc. This means they are usually hidden by default on most operating systems. Most of them live in your home directory (although projects can have local dotfiles that override global settings such as .gitignore).

You can see your global dotfiles by listing the hidden files in your home directory:

cd ~
ls -a

Where dotfiles come from

Some tools generate dotfiles automatically. Others you can add and manage yourself. For example, here are a some dotfiles for the tools I use:

  • .gitconfig is used by Git for configuration of my version control.
  • .vimrc is used by Vim for configuration of my editor.
  • Brewfile is used by Homebrew for configuration of my global packages.

Backing up dotfiles with Git

The beauty of dotfiles is it is how you like to use your tools organized in one place! You can move them to any machine you work on to feel at home. I keep my dotfiles backed up in a Git repo so they can be easily cloned and used on any machine I am on.

View my dotfiles repo

Most tools that use dotfiles require their dotfiles to exist in your home directory. So once you organize them in a Git repo like this, you need to symlink (symbolic link) them to your home directory. The index script at the root of my dotfiles repo is run to do this automatically for any amount of dotfiles in the files directory:

set -euo pipefail
echo "Symlinking dotfiles"
cd ./files
shopt -s dotglob
for root_file in *; do
ln -s "$(pwd)/$root_file" "$HOME/$root_file"
cd ..


Dotfiles are a great way to organize your settings and are the default option for many tools. I’d recommend organizing yours in a Git repo like this so that you can keep track of and reproduce your settings on any other machine.