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 dotfilesthen create the st directorymkdir -pv st.Now
cd st, thatstfolder is equivalent to your$HOMEdirectory. Now we create the same directory structure of ourstconfig.mkdir -pv .config/sucklessand now move your st config todotfiles/st/.config/suckless/stNow go back until you’re in
dotfilesonly and run the commandstow --target=/home/user stand that’s it. What this command is doing is creating a symlink tostand 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/userthen 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:
And that’s how easy it is to manage all your dotfiles. Here’s a sample of my dotfiles:


Comments