Shell Functions¶
Functions are organized by domain across four files in ~/.config/zsh/functions/.
General (general.zsh)¶
cm — Chezmoi Shortcut¶
cm # Navigate to chezmoi source directory
cm apply # Forwards to: chezmoi apply
cm diff # Forwards to: chezmoi diff
af — AWS Profile Switcher¶
Interactive AWS profile selector with SSO login:
- Lists all AWS profiles via
fzf - Exports
AWS_PROFILE - Attempts
aws sts get-caller-identity - If session expired, triggers
aws sso login - Displays account and user info on success
gh-browse — GitHub Repo Browser¶
Uses gh CLI and fzf to select and open repos.
cloner — Clone All Org Repos¶
Clones all repositories from a GitHub organization.
git_mirror_to_org — Mirror Repos Between Orgs¶
Mirrors a repository from one GitHub org to another.
Keychain secrets
Secrets live in the macOS login keychain and are managed with the keychain-secret script, not a shell function.
Kubernetes (kubectl.zsh)¶
kdebug — Debug Pod¶
Launch an ephemeral debug pod:
kdebug # busybox in default namespace
kdebug -n kube-system # busybox in kube-system
kdebug -i nicolaka/netshoot # custom image
kdebug -- curl http://my-svc # run a command
kadmin — Admin Pod¶
Launch a netshoot pod for network debugging:
kadmin # netshoot in default namespace
kadmin -n kube-system # in specific namespace
kadmin -- dig kubernetes.default # run DNS lookup
kclean — Delete Pods by Status¶
kpodbynode — Pods on a Node¶
kpodbylabel — Pods by Label¶
kremovefinalizers — Remove Finalizers¶
Removes all finalizers from a stuck resource to allow deletion.
kdelete_namespaces_with_prefix — Bulk Namespace Delete¶
Finds and deletes all namespaces matching a prefix (with confirmation).
kdelete_empty_namespaces — Clean Empty Namespaces¶
kdelete_empty_namespaces # Interactive confirmation
kdelete_empty_namespaces --yes # Skip confirmation
kdelete_empty_namespaces --prefix test- # Only matching prefix
inline_kubectl_editor — Inline Resource Editor¶
inline_kubectl_editor create # Create resource from inline YAML
inline_kubectl_editor apply # Apply inline YAML
Opens an inline editor for quick Kubernetes manifest editing.
Terraform (terraform.zsh)¶
Helper functions assume this directory structure:
tf_init — Initialize with Backend¶
tf_init mystack dev
# Runs: terraform init -reconfigure -backend-config=environments/dev.s3.tfbackend
tf_plan — Plan with Variables¶
tf_apply — Apply with Variables¶
tf_destroy — Destroy with Variables¶
clean_terraform — Clean Up¶
Talos (talos.zsh)¶
Functions for managing Talos Linux clusters.
tx — Switch Context¶
txf — Interactive Context Switcher¶
tdash — Dashboard¶
tdmesg — Kernel Messages¶
tuptime — Node Uptime¶
Shows uptime in human-readable format (days, hours, minutes).