Use GNU Stow

Jan Niklas Böhm
6. June 2017

Use GNU Stow

I recently switched to using stow for managing my configuration files, and maybe you will want to consider it, too! What is it? It is a tool that allows you to track your configuration files easily while not cluttering your home directory. It makes it easy to have all your config files in a repository for version control and thus easing the installation on another machine.

It works by creating folders in your stow directory (in my case it is ~/dotfiles/) that you name yourself. Below this folder you mimick the structure that you want your config files to have. For example, the folder emacs/ contains .emacs.d/, where everything is configured. By calling stow emacs it symlinks ~/.emacs.d to ~/dotfiles/emacs/.emacs.d/. This way you still have control over the layout of you files in the system while having a central repository for you configuration

“Why?” you might ask. Besides the obvious advantages of version control, it allows you to give an association to a filename. Ever wondered what .profile is used for? If you put it into the folder bash you give it meaning and associate it with the program.

Another reason is the easy incorporation of your configuration into stow. Simply create the folder, move the files into the directory, call stow with the folder name and you’re all set. Already have a git repository for some folders? Simply include them as a submodule; or a subtree!

I am incrementally adding all my config files to stow as I edit them and it feels like tidying up your system and structuring it.

Getting started is as simple as doing the following. Considering that stow is already installed, all it takes is:

% cd ~/dotfiles
% mkdir x
% mv ~/.Xresources x
% mv ~/.xprofile x
% stow x
% git add x
% git commit -m"Add config files for X11"

Don’t forget to also keep tidy commit messages when starting with a clean slate.