← 返回命令列表

Linux command

ctx 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Generate the initial configuration

ctx init

List all available contexts

ctx list

Activate a context

ctx use [context-name]

Show the currently active context

ctx

Install shell integration

eval "$(ctx shell-hook zsh)"

Install shell integration

eval "$(ctx shell-hook bash)"

说明

ctx is a single-binary context switcher aimed at engineers who move between multiple clouds, clusters, and VPN networks during the day. Instead of juggling AWS_PROFILE, kubectl config use-context, VPN toggles, and SSH tunnels by hand, each environment is described once as a YAML file under ~/.config/ctx/contexts/ and then activated with ctx use <name>. Switching updates the current shell session: AWS/GCP/Azure credentials, Kubernetes/Nomad contexts and namespaces, VPN connections (WireGuard, OpenVPN, Tailscale, NetBird), SSH tunnels, Docker and npm registries, Git user identity, and arbitrary environment variables are all applied together. A prompt indicator of the form ctx: name is added by the shell hook so the active environment is always visible. Secrets for credentials can be fetched at activation time from Bitwarden, 1Password, HashiCorp Vault, AWS Secrets Manager, or GCP Secret Manager, so plain passwords never need to live in the YAML files themselves.

FAQ

What is the ctx command used for?

ctx is a single-binary context switcher aimed at engineers who move between multiple clouds, clusters, and VPN networks during the day. Instead of juggling AWS_PROFILE, kubectl config use-context, VPN toggles, and SSH tunnels by hand, each environment is described once as a YAML file under ~/.config/ctx/contexts/ and then activated with ctx use <name>. Switching updates the current shell session: AWS/GCP/Azure credentials, Kubernetes/Nomad contexts and namespaces, VPN connections (WireGuard, OpenVPN, Tailscale, NetBird), SSH tunnels, Docker and npm registries, Git user identity, and arbitrary environment variables are all applied together. A prompt indicator of the form ctx: name is added by the shell hook so the active environment is always visible. Secrets for credentials can be fetched at activation time from Bitwarden, 1Password, HashiCorp Vault, AWS Secrets Manager, or GCP Secret Manager, so plain passwords never need to live in the YAML files themselves.

How do I run a basic ctx example?

Run `ctx init` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

Where can I find more ctx examples?

This page includes 6 examples for ctx, plus related commands for nearby Linux tasks.