I'm the type of person who doesn't like fancy or redundant things. Here is my streamlined bashrc file containing only the things I really need and nothing else. Please get rid of anything you feel is unnecessary.
- Namespace Management:
knsfunction for easy namespace switching - Multi-cluster Support:
ekfunction for kubeconfig switching - Pod Utilities:
ctnfor container inspection,pofor pod listing - Auto-initialization: Creates default working namespace on startup
- Safety Features: Highlights dangerous default namespace usage
- Smart Aliases:
gits,gitb,gitc,gitlfor common operations - Submodule Support:
gitppulls with automatic submodule updates - Branch Comparison:
headsgitcompares local/remote/fetch heads - Safety Warnings: Visual alerts for master/main branch usage
- Commit Helpers: Quick amend and change tracking functions
The custom prompt displays contextual information:
- 🌐/💻 Location indicator (VPS/Local)
- 💰 Bitcoin price (because why not?)
- 📊 System stats (Docker containers, screen sessions)
- ⏰ Timestamp for debugging
- 🖥️ Hostname for multi-server workflows
- ☸️ Kubernetes context (highlighted if non-default)
- 📁 Namespace (highlighted if dangerous)
- 🌿 Git branch (highlighted if master/main)
- 💬 Last commit message (prevents wrong amends)
- 📂 Current directory
- Repository Sync:
reposyncfor main→test repo synchronization - Quick Navigation:
cd1,cd2for frequent directories - Bashrc Management:
editbash,sourcebashfor quick config changes - System Monitoring: Docker and screen session counters
kns [namespace] # Switch to namespace or show current
ek [config] # Switch kubeconfig or show current
ctn <pod_name> # List all containers in a pod
ns [args] # List namespaces by creation time
po [args] # List pods in current namespacegitp [args] # Git pull with submodule update
gitpush [args] # Git push wrapper
gitchanges # Show files changed in last commit
gitamend # Amend to current commit (no edit)
headsgit # Compare local/remote/fetch headsreposync [--delete] # Sync main repo to test repo (optionally delete missing files)
cd1 # Navigate to main repository
cd2 # Navigate to test repository
editbash # Edit bashrc file
sourcebash # Reload bashrc configuration# Navigation
.. # cd ..
... # cd ../..
# Enhanced ls
ll # ls -la (detailed list)
la # ls -A (show hidden)
l # ls -CF (classify)
# Git shortcuts
gits # git status
gitb # git branch
gitc # git checkout
gitl # git log --oneline
# Safe operations
cp, mv, rm # Interactive mode by default-
Backup your current bashrc:
cp ~/.bashrc ~/.bashrc.backup
-
Copy the configuration:
cp my_bashrc ~/.bashrc -
Customize paths and sync settings (edit these in the file):
# Update these paths to match your setup cd1() { cd /path/to/main_repo; } cd2() { cd /path/to/test_repo; } # Repository sync configuration LOCAL_REPO="/your/main-repo" REMOTE_REPO="/path/on/remote/host" HOST="user@hostname" SYNC_EXCLUDES=( ".git" "__pycache__" ".venv" )
-
Set your default context:
export DEFAULT_CONTEXT="your_working_context" export DEFAULT_NS="your_working_namespace"
-
Reload your shell:
source ~/.bashrc
Demo from terminal on macOS:
Another terminal example:
All colors are defined in the COLOR DEFINITIONS section. Modify these variables to match your terminal theme:
RED="\[\e[01;31m\]"
GREEN="\[\e[01;32m\]"
# ... etcEnable/disable prompt components by modifying the reload_ps() function. Comment out unwanted elements:
# local btc_format="${GREEN}(\$(get_btc_price))${RESET}" # Disable BTC price- Linux: Works out of the box
- macOS: May need to adjust some commands (e.g.,
lsflags) - WSL: Should work with minimal adjustments
Feel free to suggest improvements or report issues. This configuration prioritizes:
- Functionality over aesthetics
- Performance over features
- Clarity over cleverness
- Colors are optimized for light terminal themes
- Bitcoin price requires
curlandjq - Kubernetes functions require
kubectl - Some functions assume specific directory structures
- The prompt updates dynamically on each command
Keep it minimal, keep it functional. ⚡

