CLI Commands

Command-line interface for CI/CD pipelines and automation scripts.

CLI is Optional

Most users manage everything through the ShellHub Dashboard — no CLI needed. The CLI is designed for:

  • CI/CD pipelines (GitHub Actions, GitLab CI, etc.)
  • Automation scripts
  • Developers who prefer terminal workflows

// Installation

# macOS / Linux
curl -fsSL https://cli.shellhub.app/install.sh | sh

# Or with npm
npm install -g @shellhub/cli

// Global Flags

FlagDescription
--help, -hShow help for any command
--version, -vShow CLI version
--jsonOutput in JSON format
--quiet, -qSuppress non-essential output
--debugEnable debug output

// Authentication

shellhub login

Authenticate with ShellHub. Opens a browser for OAuth login.

shellhub login
shellhub login --token YOUR_API_KEY  # Non-interactive

shellhub logout

Log out and clear stored credentials.

shellhub whoami

Display current authenticated user.

// Cloud Management

shellhub cloud list

List all clouds in your account.

shellhub cloud list
shellhub cloud list --json
shellhub cloud list --status running

shellhub cloud create

Create a new cloud environment.

shellhub cloud create --name my-cloud --region us-east-1
shellhub cloud create --name prod --region eu-central-1 --tier pro
FlagDescription
--nameCloud name (required)
--regionRegion code (required)
--tierstarter, pro, enterprise

shellhub cloud delete

Delete a cloud and all its agents.

shellhub cloud delete my-cloud
shellhub cloud delete my-cloud --force  # Skip confirmation

// Deployment

shellhub deploy

Deploy an agent from the current directory.

shellhub deploy --cloud my-cloud
shellhub deploy --cloud my-cloud --wait  # Wait for deployment
shellhub deploy -f path/to/shellhub.yaml
FlagDescription
--cloud, -cTarget cloud
-f, --filePath to shellhub.yaml
--waitWait for deployment to complete
--envSet environment variable (can repeat)

shellhub redeploy

Redeploy an existing agent with the latest code.

shellhub redeploy my-agent
shellhub redeploy my-agent --rollback  # Rollback to previous version

// Agent Management

shellhub agents list

List all agents across all clouds.

shellhub agents list
shellhub agents list --cloud my-cloud
shellhub agents list --status running

shellhub status

Get detailed status of an agent.

shellhub status my-agent
shellhub status my-agent --watch  # Auto-refresh

shellhub logs

View agent logs.

shellhub logs my-agent
shellhub logs my-agent --follow  # Stream logs
shellhub logs my-agent --tail 100  # Last 100 lines
shellhub logs my-agent --since 1h  # Last hour

shellhub stop / start / restart

Control agent lifecycle.

shellhub stop my-agent
shellhub start my-agent
shellhub restart my-agent

shellhub delete

Delete an agent permanently.

shellhub delete my-agent
shellhub delete my-agent --force

// Secrets Management

shellhub secrets list

List all secrets (names only, not values).

shellhub secrets set

Create or update a secret.

shellhub secrets set MY_SECRET --cloud my-cloud
# Enter value when prompted

shellhub secrets set MY_SECRET --value "..." --cloud my-cloud

shellhub secrets delete

Delete a secret.

shellhub secrets delete MY_SECRET --cloud my-cloud

// Monitoring

shellhub metrics

View agent or cloud metrics.

shellhub metrics my-agent
shellhub metrics my-agent --period 24h
shellhub metrics my-agent --metrics cpu,memory,requests

Quick Reference

# Authentication
shellhub login                        # Authenticate
shellhub logout                       # Log out
shellhub whoami                       # Show current user

# Clouds
shellhub cloud list                   # List all clouds
shellhub cloud create --name X        # Create cloud
shellhub cloud delete X               # Delete cloud

# Deployment
shellhub deploy --cloud X             # Deploy from current dir
shellhub redeploy X                   # Redeploy agent

# Agent Management
shellhub agents list                  # List all agents
shellhub status X                     # Agent status
shellhub logs X --follow              # Stream logs
shellhub stop/start/restart X         # Lifecycle
shellhub delete X                     # Delete agent

# Secrets
shellhub secrets list                 # List secrets
shellhub secrets set KEY              # Set secret
shellhub secrets delete KEY           # Delete secret

# Monitoring
shellhub metrics X --period 24h       # View metrics