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 - On-demand initialization:
kinit_nscreates the default working namespace when requested - 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 (cached with short network timeouts)
- 📊 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 - Central Python venvs: per-project virtualenvs in
~/.venvswith automatic activation - System Monitoring: Docker and screen session counters
kns [namespace] # Switch to namespace or show current
kinit_ns # Create DEFAULT_NS in the current cluster if needed
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 configurationcreate_central_venv [name] # Create and activate ~/.venvs/<name>
activate_central_venv <name> # Activate an existing central venv
list_central_venvs # List central venvs
central_venv_path [name] # Print the central venv pathWhen a matching central venv exists, entering ~/project-name automatically activates
~/.venvs/project-name. Leaving the project deactivates only venvs that were
auto-activated.
# 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 (-i)-
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
-
Optional: create your default Kubernetes namespace:
kinit_ns
-
Optional: create central Python virtualenvs:
cd ~/my-python-project create_central_venv python -m pip install -r requirements.txt
After the venv exists, future
cd ~/my-python-projectcommands auto-activate it.
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; failures returnN/Aor the last cached value - Kubernetes functions require
kubectl - Some functions assume specific directory structures
- The prompt updates dynamically on each command
- Sourcing the file is passive: it does not create Kubernetes resources or change directories
- Central Python venv activation is passive: it only activates existing
~/.venvs/<project>environments and never creates them automatically
Keep it minimal, keep it functional. ⚡

