Getting Started
This guide will help you set up ctx and create your first context.
Installation
Quick Install
From Source
git clone https://github.com/vlebo/ctx.git
cd ctx
go build -o ctx ./cmd/ctx
sudo mv ctx /usr/local/bin/
Shell Integration
Add to your shell configuration file:
This enables:
- Context name in your prompt:
[ctx: myproject-prod] - Automatic environment variable loading on
ctx use - Per-shell context isolation
- Auto-load last context in new shells (can be disabled)
Disable Auto-Load in New Shells
By default, new shell sessions automatically load the last active context. To disable this and start fresh:
- Run
ctx shell-hookto see the generated code - Find and comment out the auto-load section at the bottom
Initialize ctx
This creates the configuration directory at ~/.config/ctx/.
Create Your First Context
Create a file at ~/.config/ctx/contexts/myproject-dev.yaml:
name: myproject-dev
description: "MyProject Development Environment"
environment: development
aws:
profile: myproject-dev
region: us-west-2
kubernetes:
context: arn:aws:eks:us-west-2:123456789:cluster/dev
namespace: default
Switch Context
Verify
# Show current context status
ctx
# Test AWS
aws sts get-caller-identity
# Test Kubernetes
kubectl get pods
What's Next?
- Configuration Overview - Learn all configuration options
- Context Inheritance - Avoid repeating configuration
- AWS Setup - AWS SSO, aws-vault, and more
- SSH Tunnels - Auto-connect to databases and services
- VPN - Auto-connect VPN on context switch