Lesson 6 of 9 · 18m
Dotfiles: An Environment That Travels
Shell config, git config, editor config — the dotfile discipline that makes any machine yours in five minutes.
Dotfiles are the hidden config files (.*) in your home directory — .bashrc, .gitconfig, .vimrc, .ssh/config. Versioned in a git repo, they turn a new machine into your machine in minutes.
What belongs in dotfiles
- Shell config — aliases, PATH additions,
exported vars, prompt customization. - Git config —
user.name,user.email, aliases (git st,git lg),core.editor,pull.rebase. - Editor config —
.vimrc/init.vim, VS Codesettings.jsonfor the keybindings and extensions you rely on. - Tool configs —
.tmux.conf,.zshrc,.inputrc,.gitignore_global.
The structure
~/dotfiles/
.bashrc
.gitconfig
.vimrc
.tmux.conf
install.sh # symlink everything into ~#!/usr/bin/env bash
for file in ~/dotfiles/.*; do
ln -sf "$file" ~/
doneSymlinks keep the repo as the source of truth — git pull updates the config on every machine instantly.
Field notes
.bashrcvs.bash_profilevs.zshrc— login shells read profile, interactive non-login shells read rc. On most Linux distros they source each other; on macOS (zsh) it's.zprofile+.zshrc.chezmoi/stow/dotbotare the mature tools for templated dotfiles — when you need per-machine variations (work vs personal), a template variable beats aif [ "$(hostname)" = ... ]shell branch.- Never commit secrets —
.envfiles, API keys, SSH private keys. Dotfiles are for configuration, not credentials.