Skip to content
AstroPaper
Go back

Managing Daily-Use Scripts with a Dotfiles Repo

Edit page

Managing personal scripts is a common friction point for developers. You accumulate useful one-offs — a backup helper, a git cleanup tool, a deploy shortcut — and suddenly they’re scattered across your home directory with no structure or version history. The dotfiles repo pattern solves this neatly.

The Problem

Scripts tend to pile up without a system:

The Standard Solution: bin/ in Your Dotfiles Repo

The most widely-used approach is a bin/ folder inside your dotfiles repo, added to PATH:

~/.dotfiles/
├── bin/          ← scripts live here
│   ├── weather
│   ├── git-cleanup
│   └── backup
├── .vimrc
├── .tmux.conf
└── .bashrc

Add it to your shell config:

# ~/.bashrc or ~/.zshrc
export PATH="$HOME/.dotfiles/bin:$PATH"

Now weather, git-cleanup, and backup are available anywhere, versioned alongside your other configs.

With GNU Stow

If you use stow to manage symlinks, it will link ~/.dotfiles/bin/~/bin/ automatically, and ~/bin is already in PATH on most Linux systems.

Naming Conventions

Following Unix conventions keeps scripts discoverable and composable:

ConventionExampleWhy
No .sh extensionbackup not backup.shRun as backup, not backup.sh
Category prefixgit-cleanup, git-pruneGroups related commands; mirrors git sub-commands
Lowercase kebab-casedocker-nukeConsistent with Unix tooling

Scripts vs. Aliases vs. Functions

The right place for a command depends on its complexity:

flowchart TD
    A[New command idea] --> B{One line?}
    B -- Yes --> C[Shell alias in .bashrc]
    B -- No --> D{Needs logic / reuse?}
    D -- No --> E[Shell function in .bashrc]
    D -- Yes --> F[Script in bin/]

Other Approaches People Use

Script Managers

Useful if you want to pull in scripts from the community, but overkill for personal scripts.

Gists

Some developers store individual scripts as GitHub Gists. Easy to share publicly, but hard to organize and not directly executable.

TIL / Personal Wiki

A repo of short notes + scripts (e.g. til/bash/resize-images.md). Searchable and version-controlled, but scripts need to be copied out to use them.

Note-taking Apps

Storing snippets in Obsidian, Notion, or similar. Searchable, but not executable in place.

For most developers, this is enough:

dotfiles repo (on GitHub)
├── bin/        ← standalone scripts, in PATH, no .sh extension
├── .bashrc     ← aliases and one-liner functions
├── .vimrc
└── .tmux.conf

✅ Version-controlled ✅ Synced across machines via git ✅ Scripts run directly by name ✅ Lives alongside your other config

Search GitHub for “dotfiles” to see thousands of real-world examples and get inspiration.


Edit page
Share this post on:

Previous Post
pyproject.toml: Python's Single Source of Truth
Next Post
Line Length Conventions in Code: Focus on Bash