Shell Productivity
Aliases, shell functions, and history tricks for Python developers living in bash/zsh - faster git, uv, pytest, and SSH without memorizing every flag.
Search across all documentation pages
Aliases, shell functions, and history tricks for Python developers living in bash/zsh - faster git, uv, pytest, and SSH without memorizing every flag.
# ~/.bashrc or ~/.zshrc
alias gs='git status -sb'
alias uvr='uv run'
alias pyt='uv run pytest -q'
gco() { git checkout "$@"; }When to reach for this:
curl | jq pipeline from history# ~/.zshrc excerpts for Python monorepo
export PATH="$HOME/.local/bin:$PATH"
alias uvs='uv sync'
alias uvt='uv run pytest -q'
alias ruffc='uv run ruff check .'
alias rufff='uv run ruff format .'
# Smoke function committed pattern - promote to bin/smoke.sh when shared
billing-smoke() {
set -euo pipefail
curl -sf http://localhost:8000/health
curl -sf http://localhost:8000/ready
echo "smoke ok"
}
# fzf git checkout (requires fzf)
alias gcb='git branch | fzf | xargs git checkout'What this demonstrates:
set -euo pipefail for smoke testsHISTSIZE, HISTFILESIZE, histappend for persistence.| Tool | Purpose |
|---|---|
fzf | Fuzzy select files, branches |
direnv | Auto-load .envrc per project dir |
zoxide | z billing jump to frecent dir |
starship | Cross-shell prompt with venv indicator |
# Show active venv in prompt - starship python module or:
export PS1='($(basename $VIRTUAL_ENV)) \u@\h:\w$ '
# History search backward for rg
bind '"\C-r": reverse-search-history' # bash defaultalias ls='ls --color' OK; masking python dangerous. Fix: avoid alias on python, rm, git push.set -euo pipefail at top.curl -H "Authorization: Bearer ..." saved. Fix: HISTIGNORE pattern or space-prefix + HISTCONTROL=ignorespace./opt/app/bin.~/.bashrc.d/.| Alternative | Use When | Don't Use When |
|---|---|---|
Makefile make test | Team wants one interface | Windows-only devs without make |
just runner | Rich command recipes | Zero extra deps policy |
| IDE tasks | GUI-centric devs | SSH-only operators |
| Dedicated CLI (Typer) | Complex subcommands | Simple alias enough |
Both fine on macOS/Linux - zsh default on macOS; ensure scripts are bash-compatible for CI.
.envrc with layout uv or source .venv/bin/activate auto on cd.
Document in repo docs/shell.md - do not force dotfiles via repo without opt-in.
export HISTTIMEFORMAT='%F %T ' in bash for when you ran that migration command.
git config --global core.excludesfile ~/.gitignore_global for .DS_Store, .idea.
Check bindkey in zsh; install fzf keybindings package.
uv generate-shell-completion zsh >> ~/.zshrc completion dir.
Aliases often disabled - use full commands in cron/systemd.
Disable unused plugins; starship alone is lighter.
When it has args, error handling, or is shared by team - move to bin/ with tests.
Stack versions: This page was written for Python 3.14.0 (stable 3.14, maintenance 3.13), FastAPI 0.115+, Django 5.2, Flask 3.1, Pydantic 2, PyTorch 2.6+, pandas 2.2+, Polars 1.x, ruff 0.9+, and uv 0.6+.
Reviewed by Chris St. John·Last updated Jul 19, 2026