In my previous post about just, I showed how a justfile in each project keeps all commands in one place. But some commands are not tied to any project. Updating dotfiles, cleaning up Docker, checking disk usage. You want those available everywhere.
The solution is a global justfile.
This post is part of my terminal workflow series.
How it works
Create a justfile in your config folder:
mkdir -p ~/.config/justtouch ~/.config/just/justfileThen add an alias to your .zshrc:
alias jg="just --global-justfile --choose"The --global-justfile flag (available since v1.14) automatically looks for ~/.config/just/justfile. Adding --choose opens a fuzzy finder every time, so you pick a recipe instead of remembering its name.
Now jg opens a fuzzy finder with all your global recipes, no matter where you are. Your per-project just keeps working as before.
Example global justfile
# Show available commandsdefault: @just --list
# ---------- System ----------
# Update Homebrew and all packagesbrew-update: brew update && brew upgrade && brew cleanup
# Show disk usage for home directorydisk: du -sh ~/* 2>/dev/null | sort -rh | head -20
# Clean up Docker (containers, images, volumes)docker-clean: docker system prune -af --volumes
# ---------- Dotfiles ----------
# Pull latest dotfilesdotfiles-pull: cd ~/dotfiles && git pull
# Push dotfiles changesdotfiles-push: cd ~/dotfiles && git add -A && git commit -m "update" && git push
# ---------- SSH ----------
# List all SSH keysssh-keys: ls -la ~/.ssh/*.pub
# Copy SSH public key to clipboardssh-copy: pbcopy < ~/.ssh/id_ed25519.pub && echo "Public key copied to clipboard"
# ---------- Utilities ----------
# Show current public IPmy-ip: curl -s ifconfig.me && echo ""
# Kill process on a specific portkill-port port: lsof -ti :{{port}} | xargs kill -9 2>/dev/null || echo "No process on port {{port}}"Usage
# Open fuzzy finder with all global recipesjg
# Run a specific recipe directlyjust --global-justfile brew-updateThat is it. One file for all your machine-wide commands, one alias to run them from anywhere.