Skip to content

Instantly share code, notes, and snippets.

@superbspeed
superbspeed / gist:fa825d825450a3fce8a24c49d7110584
Created January 25, 2026 02:17
Aliases for kubectl commands
# Store these in your .bashrc or .zshrc
# Change kubectl namespace in current context
kns() {
if [ -z "$1" ]; then
echo "Current namespace: $(kubectl config view --minify --output 'jsonpath={..namespace}' 2>/dev/null || echo 'default')"
echo "Usage: kns <namespace>"
echo "Available namespaces:"
kubectl get namespaces --output=name | sed 's/namespace\///'
return 1