Are you having a hard time managing your dot files and keeping them synced up with your repositories? Don’t worry, in this short article, I’ll show you how easily you can automate it.

Install Stow

First install GNU stow, its a basic program which means it’s in most Linux distribution repositories.

How it Works

The way stow works, is by creating a symlink to any directory you want and it puts the symlink where the directory/file belongs. For example, I have a config file for my terminal in ~/.config/suckless/st. I also have dotfiles repo where I keep everything.

  • First cd dotfiles then create the st directory mkdir -pv st.

  • Now cd st, that st folder is equivalent to your $HOME directory. Now we create the same directory structure of our st config.

  • mkdir -pv .config/suckless and now move your st config to dotfiles/st/.config/suckless/st

  • Now go back until you’re in dotfiles only and run the command stow --target=/home/user st and that’s it. What this command is doing is creating a symlink to st and using your home directory as the location of the symlinks, this is useful if you keep all your repos in /home/user/repos/. If you run it without --target=/home/user then the symlink would be in the root of that directory instead of where the config file belongs.

You’ll see a symlink of st in your /home/user/.config/suckless/st. Every change you make to that file will automatically happen on the original which is in dotfiles/st/.config/suckless/st.

Obviously using the command to stow only one directory is inefficient, to stow all directories in your repo except the README:

1stow --target=/home/user/ */

And that’s how easy it is to manage all your dotfiles. Here’s a sample of my dotfiles:

repo
The repo, you can see the folders for all my configs

symlinks
All the symlinks it creates