it's not a bug, it's a feature.
Understanding Stow: A Beginner’s Guide to Managing DotfilesAug 2025

Understanding stow

GNU Stow is a handy symlink manager, often used to manage dotfiles or keep software installations organized. Instead of copying configuration files directly, Stow creates symbolic links from a central directory to their intended locations.


Basic Concept

Stow works by:

  1. Having a directory of packages (e.g., dotfiles/).

  2. Each package contains files arranged as they should appear in the target location.

  3. Stow creates symlinks from the target directory to the files inside your package directory.


The Command:

stow -t ~ . --adopt

Breaking It Down

  • stowThe command to invoke GNU Stow.

  • -t ~Sets the target directory to your home directory (~).This is where symlinks will be created.

  • .Tells Stow to operate on the current directory.This assumes your current directory contains the files or subdirectories you want to stow.

  • --adoptThis is a special mode:

    • If the target directory (~) already has real files (not symlinks) where the symlinks should go,Stow will move those files into the stow package directory and then create the symlinks.

    • This is very useful for importing existing configuration files into a Stow-managed setup.


Example Use Case

Let's say you have existing config files:

~/.bashrc
~/.vimrc

You want to manage them under ~/dotfiles/ with Stow.

  1. Create a dotfiles directory and a subfolder for each "package" (e.g., shell/, vim/).

  2. Move into the package directory containing your desired structure:

    cd ~/dotfiles
  3. Run:

    stow -t ~ . --adopt
  4. Stow will:

    • Move ~/.bashrc into dotfiles/shell/.bashrc.

    • Move ~/.vimrc into dotfiles/vim/.vimrc.

    • Create symlinks in ~ pointing back to these files.


Why --adopt is Powerful

Without --adopt, Stow will complain if a target file already exists and is not a symlink.With --adopt, it "takes ownership" of existing files, making it perfect for transitioning an existing setup into Stow’s management without manual file moves.


Quick Caution

  • Always back up your files before using --adopt, especially if you’re new to Stow.

  • Double-check your directory structure—Stow works best when the folder layout in your package directory mirrors the target directory exactly.


If you want, I can expand this into a more advanced guide showing how to organize multiple packages and undo --adopt actions.