Managing Dotfiles with GNU Stow
25 Oct 2025
Every Linux developer likely has a plethora of dotfiles to customise and configure their machine exactly how they want it. Whether it’s a .bashrc or a .vimrc, these files turn your Linux experience from boring and limited to customised and feature-rich. But what happens when we want to bootstrap a new machine, or SSH into a server and have all the customisations we worked hard to create? We clearly need an effective way to share and sync our dotfiles across systems.
There are many ways to manage dotfiles. Previously I used the bare repository method. Recently, however, I switched to GNU Stow. In my opinion, Stow together with Git provides the simplest and most effective solution.
If you would like to read about using a bare repository to manage dotfiles, see this Atlassian blog post.
What is GNU Stow?
If you want a long, dry but thorough explanation, read the GNU Stow official documentation. Let’s not overcomplicate it though — Stow is basically a symbolic link manager. For our use case, it creates and manages symlinks from one directory to another, letting us store dotfiles where we choose while keeping them available in the user’s home directory.
Using GNU Stow
First, install stow using your favourite package manager.
Stow lets us keep dotfiles in one location and symlink them into the user’s home directory. For example:
~/dotfiles/
└── git/
└── .gitconfig Git expects this file in $HOME; Stow places it there for us.
stow -d ~/dotfiles/git -t $HOME This symlinks the contents of the git directory into the home directory. .gitconfig is now present there, and Git will use it.
A Dotfiles Repository
With Stow we can symlink our dotfiles for various packages in a Git repository. This way all our dotfiles can be shared across machines using Git. We can create a repository called dotfiles and organise our dotfiles into ‘package’ directories. These ‘packages’ configure specific or related tools. For instance, we might call our packages git, bash, vim, etc.
~/dotfiles/
└── git/
└── .gitconfig
└── bash/
└── .bashrc
└── .profile
└── vim/
└── .vimrc Now, whenever we want to bootstrap a new machine with all our dotfiles, we just run a few commands.
Clone the repository:
cd ~
git clone [email protected]:<github-user>/dotfiles Stow the desired packages:
stow -d dotfiles/ -t $HOME git bash vim The result is a home directory with all our dotfiles exactly where we need them.
~/
└── .gitconfig
└── .bashrc
└── .profile
└── .vimrc