What are dotfiles?
Dotfiles are configuration files that control how command-line tools, shells, editors, terminals, and desktop apps behave. They are called dotfiles because many Unix-like systems hide files that begin with a dot, such as .zshrc, .gitconfig, and .tmux.conf. Managing dotfiles lets you back up, version, share, and rebuild your personal development environment.
That is the short version. The practical version is this: your dotfiles are the memory of your setup. They hold your shell aliases, Git defaults, editor preferences, terminal colors, prompt style, tmux shortcuts, window manager bindings, and the tiny decisions that make a machine feel like yours.
If you have ever set up a new laptop and thought, “Why does my terminal feel wrong?” you have already felt the dotfiles problem. The fix is not to remember every setting manually. The fix is to organize your configuration files so they can be reviewed, backed up, and reinstalled.
This guide starts from zero. By the end, you will know what dotfiles are, which files matter first, how to put them in Git, how symlinks work, when to use GNU Stow, chezmoi, yadm, or Dotbot, and how to avoid leaking secrets.
Common dotfiles examples
Dotfiles usually live in your home directory or inside ~/.config. The exact files depend on your operating system and tools.
| File or folder | Tool | What it controls |
|---|---|---|
.bashrc | Bash | aliases, prompt, functions, shell startup behavior |
.zshrc | Zsh | prompt, plugins, completions, aliases, PATH changes |
.gitconfig | Git | username, email, aliases, default branch behavior, editor |
.tmux.conf | tmux | prefix key, panes, status bar, copy mode |
.vimrc | Vim | keybindings, plugins, editor behavior |
.config/nvim/ | Neovim | Lua config, plugins, LSP, themes, keymaps |
.config/starship.toml | Starship | shell prompt modules and styling |
.config/kitty/ | Kitty | terminal font, colors, keyboard shortcuts |
.config/ghostty/ | Ghostty | terminal theme, font, window behavior |
.config/hypr/ | Hyprland | compositor rules, keybindings, monitors, animations |
.config/waybar/ | Waybar | status bar modules and CSS styling |
Modern Linux and macOS setups often use the XDG Base Directory layout, which puts most per-user configuration under ~/.config. The freedesktop.org specification defines the base directory variables used by many Linux apps: XDG Base Directory Specification.
You do not need to manage every file at once. Start with the files you touch every day: shell, Git, terminal, editor, and tmux.
Why dotfiles matter
Dotfiles turn a fragile personal setup into something you can understand and rebuild. That matters for beginners because the first machine setup is usually messy. You install a shell plugin here, copy a theme there, paste a Git alias from a forum, and six months later you have no idea which parts are important.
Good dotfile management gives you:
- Portability: move your shell, terminal, editor, and Git workflow to a new machine.
- Version history: see what changed when your prompt, editor, or terminal breaks.
- Backup: avoid losing your setup when a laptop dies.
- Repeatability: rebuild a familiar environment with fewer manual steps.
- Learning: read your own config and understand what each line does.
- Experiment safety: test changes on a branch and roll back if needed.
Dotfiles are also the foundation of Linux ricing. If you want a polished desktop later, read The 2026 Linux Ricing Guide after this guide. Ricing is mostly dotfiles plus taste, patience, and a little restraint.
The best beginner dotfiles strategy
The best beginner strategy is boring in a good way: create one Git repository, copy only a few important config files into it, use symlinks or a dotfile manager to connect those files back to your home directory, and document every dependency.
Start with this scope:
- shell config:
.zshrcor.bashrc - Git config:
.gitconfig - terminal config: one folder from
~/.config - editor config:
.config/nvimor your preferred editor settings - tmux config:
.tmux.conf, if you use tmux - a
README.md - a
.gitignore - an install script only after you understand the manual steps
Do not start by importing your entire home directory. That usually captures caches, local state, secrets, broken experiments, and app-generated files that do not belong in a public or portable repository.
Folder structure for your first dotfiles repo
Use a clear structure that separates files by tool:
dotfiles/
README.md
.gitignore
shell/
zshrc
git/
gitconfig
tmux/
tmux.conf
config/
nvim/
init.lua
kitty/
kitty.conf
scripts/
install.sh
This structure is easy to read, but it is not the only valid option. Some people mirror the home directory exactly. Others use GNU Stow package folders. Others use chezmoi's source-state naming conventions. The important thing is that future-you can open the repository and understand what each file manages.
Add a README immediately:
# My dotfiles
Personal shell, Git, terminal, editor, and tmux configuration.
## Tools
- zsh
- Git
- Neovim
- tmux
- Kitty
## Install notes
Read scripts before running them. Back up existing files first.
Small documentation beats clever automation when you are learning.
Create your dotfiles repository with Git
Create a new local repository:
mkdir -p ~/dotfiles
cd ~/dotfiles
git init
touch README.md .gitignore
git add README.md .gitignore
git commit -m "Initial dotfiles repo"
Then copy a few existing configs into it:
mkdir -p shell git tmux
cp ~/.zshrc shell/zshrc 2>/dev/null || true
cp ~/.bashrc shell/bashrc 2>/dev/null || true
cp ~/.gitconfig git/gitconfig 2>/dev/null || true
cp ~/.tmux.conf tmux/tmux.conf 2>/dev/null || true
Review every copied file before committing. Remove machine-specific paths, work-only settings, tokens, private hostnames, and anything you do not understand.
git diff -- shell git tmux
git status
git add shell git tmux
git commit -m "Add initial shell git and tmux configs"
If you use GitHub, keep the repository private until you have audited it. Public dotfiles are useful for learning, but public secrets are expensive mistakes.
Add a safe dotfiles .gitignore
Git ignore rules keep generated files out of your dotfiles repo. The Git documentation defines how gitignore patterns work: gitignore documentation. GitHub's docs also explain repository and global ignore files: Ignoring files.
Start with a conservative .gitignore:
# Secrets and local overrides
*.secret
*.local
*.key
*.pem
.env
.env.*
# OS clutter
.DS_Store
Thumbs.db
# Editor and swap files
*.swp
*.swo
*~
# Generated caches
.cache/
node_modules/
__pycache__/
# Logs
*.log
This is not a substitute for reviewing files. A .gitignore helps prevent accidents, but it does not protect secrets that you already committed. If you commit a secret, rotate the credential and remove it from history.
Manual symlinks: the simplest dotfiles method
A symlink is a file-system pointer from one path to another. For dotfiles, you store the real file in your repository and place a symlink where the application expects the config.
Back up your existing files first:
mkdir -p ~/dotfiles-backup
cp ~/.zshrc ~/.gitconfig ~/.tmux.conf ~/dotfiles-backup/ 2>/dev/null
Then create symlinks:
ln -sf ~/dotfiles/shell/zshrc ~/.zshrc
ln -sf ~/dotfiles/git/gitconfig ~/.gitconfig
ln -sf ~/dotfiles/tmux/tmux.conf ~/.tmux.conf
For XDG-style config folders:
mkdir -p ~/.config
ln -sfn ~/dotfiles/config/nvim ~/.config/nvim
ln -sfn ~/dotfiles/config/kitty ~/.config/kitty
Manual symlinks are perfect for learning because nothing is hidden. The downside is that install scripts can become messy as your setup grows.
GNU Stow for dotfiles
GNU Stow is a symlink manager. Its manual describes it as a tool that makes separate directories appear installed in one target tree through symbolic links, and notes that it is commonly used to manage configuration files in a user's home directory: GNU Stow manual.
Stow works best when your repo mirrors the target directory layout:
dotfiles/
zsh/
.zshrc
git/
.gitconfig
tmux/
.tmux.conf
nvim/
.config/
nvim/
init.lua
From inside ~/dotfiles, stow packages into your home directory:
cd ~/dotfiles
stow zsh
stow git
stow tmux
stow nvim
To preview changes before applying them:
stow --simulate --verbose zsh
Stow is a great first dotfile manager if you like simple tools and transparent symlinks. The main rule is to keep the folder layout clean.
chezmoi for multi-machine dotfiles
chezmoi is a dotfile manager built for people who use multiple machines or need templates, encryption, and machine-specific differences. Its docs emphasize managing dotfiles securely across machines: chezmoi.
The basic flow looks like this:
chezmoi init
chezmoi add ~/.zshrc
chezmoi add ~/.gitconfig
chezmoi cd
git status
git add .
git commit -m "Add shell and git dotfiles"
exit
To apply changes:
chezmoi diff
chezmoi apply
Choose chezmoi if you want one dotfiles repo to handle Linux and macOS, work and personal machines, or private values that should not be committed as plain text.
yadm for Git-native dotfiles
yadm stands for Yet Another Dotfiles Manager. Its project site describes it as a dotfiles manager that feels familiar if you already know Git: yadm.
yadm stores dotfiles in a bare Git repository while leaving files where they normally live:
yadm init
yadm add ~/.zshrc ~/.gitconfig ~/.tmux.conf
yadm commit -m "Track initial dotfiles"
Then you use Git-like commands:
yadm status
yadm diff
yadm log
yadm is a good fit when you want dotfiles under version control without moving files into a separate folder structure. It is less visual for beginners than a normal ~/dotfiles directory, but it is elegant once you understand the model.
Dotbot for scripted installs
Dotbot is a tool for bootstrapping dotfiles from a config file: Dotbot GitHub. It is useful when you want a repeatable install process but do not want to write a large shell script yourself.
A Dotbot-style setup usually defines links in YAML:
- defaults:
link:
relink: true
create: true
- link:
~/.zshrc: shell/zshrc
~/.gitconfig: git/gitconfig
~/.tmux.conf: tmux/tmux.conf
For beginners, Dotbot is best after you understand symlinks. Automation is easier to debug when you know what it is automating.
Dotfiles manager comparison
| Method | Best for | Pros | Tradeoffs |
|---|---|---|---|
| Manual symlinks | learning and small setups | clear, no extra tool, easy to inspect | install scripts get repetitive |
| GNU Stow | clean symlink-based repos | simple mental model, reversible, widely used | requires tidy directory layout |
| chezmoi | multiple machines and private differences | templates, secrets workflows, strong apply and diff model | more concepts to learn |
| yadm | Git-native dotfile tracking | files stay where apps expect them, familiar commands | bare repo model can confuse beginners |
| Dotbot | scripted bootstrap installs | declarative links, repeatable setup | another dependency and config format |
If you are brand new, start with manual symlinks or Stow. If you already know you need multi-machine templating, start with chezmoi. If you want Git behavior without moving files, try yadm.
Keep secrets out of dotfiles
The most important dotfiles rule is simple: do not commit secrets. Dotfiles often sit close to API tokens, SSH hostnames, access keys, Git signing settings, private package registries, and work-specific URLs.
Never commit:
- SSH private keys
- API tokens
.envfiles- cloud credentials
- work VPN configs
- private hostnames
- passwords
- session cookies
- production database URLs
GitHub provides secret scanning features and documentation for securing secrets: GitHub secret scanning. Still, scanners are a backstop, not a workflow.
Use this pattern instead:
# Safe to commit
export EDITOR=nvim
alias gs="git status --short"
# Not safe to commit
export PRIVATE_API_TOKEN="real-token-here"
For local-only shell values, create a file that is sourced but ignored:
# In ~/.zshrc
if [ -f "$HOME/.config/shell/local.zsh" ]; then
source "$HOME/.config/shell/local.zsh"
fi
Then add local.zsh to .gitignore.
A safe install checklist
Before you install your dotfiles on a new machine, run through this checklist.
# Confirm where you are
pwd
git status
# Read install scripts before running them
sed -n '1,220p' scripts/install.sh
# Search for risky commands and secrets
rg -n "rm -rf|curl|wget|sudo|chmod|chown|TOKEN|PASSWORD|SECRET|PRIVATE_KEY" .
# Back up existing configs
mkdir -p ~/dotfiles-backup
cp -a ~/.zshrc ~/.bashrc ~/.gitconfig ~/.tmux.conf ~/.config/nvim ~/dotfiles-backup/ 2>/dev/null
# Preview symlinks if using Stow
stow --simulate --verbose zsh git tmux nvim
Do not run an install script until you have read it. Do not run a remote script just because someone says it is convenient. Good dotfiles should be understandable.
Sync dotfiles across Linux and macOS
Linux dotfiles and macOS dotfiles overlap, but they are not identical. A portable repo should separate shared configuration from machine-specific configuration.
Use patterns like:
dotfiles/
shell/
zshrc
aliases
linux.zsh
macos.zsh
git/
gitconfig
gitconfig-work
config/
nvim/
kitty/
Then conditionally source OS-specific files:
case "$(uname -s)" in
Linux)
[ -f "$HOME/.config/shell/linux.zsh" ] && source "$HOME/.config/shell/linux.zsh"
;;
Darwin)
[ -f "$HOME/.config/shell/macos.zsh" ] && source "$HOME/.config/shell/macos.zsh"
;;
esac
Keep work identity separate too. Git supports conditional includes, which are useful when your work repositories need a different email:
[user]
name = Your Name
email = personal@example.com
[includeIf "gitdir:~/work/"]
path = ~/.config/git/work.gitconfig
What to customize first
If you are overwhelmed, customize in this order:
- Git username, email, editor, and a few aliases.
- Shell aliases and PATH cleanup.
- Terminal font and colors.
- Editor config.
- tmux config, if you use tmux.
- Prompt and shell plugins.
- Window manager, bar, launcher, and ricing files.
The goal is not to create a huge config repo on day one. The goal is to capture the setup choices that save you time every day.
For related guides, read The Best Zsh Plugins for 2026, Tmux for Beginners, and Beautiful Terminal Color Schemes to Try.
How Dotfiles Market fits into learning dotfiles
Dotfiles are easier to learn when you can compare real setups. Dotfiles Market is useful as a discovery layer: browse all showcases, compare environment categories, study Shell, Terminal, and Editor configurations, and notice how different people structure the same kinds of files.
Use examples as references, not rules. Copying an entire setup without understanding it can make your machine harder to maintain. Studying how a good setup is organized teaches you what to bring into your own repo.
FAQ
Should my dotfiles repo be public or private?
Start private. After you audit secrets, remove machine-specific details, and understand what each file contains, you can make it public if you want others to learn from it.
Should beginners use GNU Stow or chezmoi?
Use GNU Stow if you want a simple symlink-based setup and a clear folder layout. Use chezmoi if you need templates, encrypted secrets, or different config values on different machines.
Do dotfiles work on macOS?
Yes. macOS uses many Unix-style tools, so shell, Git, tmux, Neovim, and terminal dotfiles work well. Some Linux desktop files, such as Hyprland or Waybar configs, are Linux-specific.
Can I put my entire .config folder in Git?
You can, but you usually should not. Many apps store caches, local state, generated files, or machine-specific data in .config. Track specific subfolders you understand, such as nvim, kitty, ghostty, or waybar.
What is the safest first dotfile to track?
.gitconfig is often the safest first file because it is small and easy to inspect. After that, track your shell config and terminal config.
What happens if a symlink breaks?
The application will usually fail to read that config or fall back to defaults. Fix the symlink path, recreate it, or restore your backup. This is why a backup folder and README are worth the small effort.
How many dotfiles should I track at first?
Start with three to five files or folders you understand: .gitconfig, shell config, terminal config, tmux config, and one editor folder. Add window manager, bar, launcher, and full rice files only after your backup and restore workflow feels reliable.
Sources and further reading
This guide was last updated on May 7, 2026.
The tooling and safety references used here are GNU Stow, chezmoi, yadm, Dotbot, gitignore documentation, GitHub ignoring files, GitHub secret scanning, and the XDG Base Directory Specification.

