Skip to content

CLI Quickstart

The Sairo CLI brings indexed search and listing to your terminal. Instead of enumerating S3 objects live on every command (like mc or aws s3), it queries Sairo’s pre-built SQLite FTS5 index — returning results in milliseconds regardless of bucket size.

Terminal window
brew install ashwathstephen/sairo/sairo

Verify installation:

Terminal window
sairo version
  1. Connect to your Sairo instance:

    Terminal window
    sairo login https://sairo.example.com

    Enter your username and password when prompted. If 2FA is enabled, you’ll be asked for your TOTP code.

  2. Verify the connection:

    Terminal window
    sairo status
    Profile: production
    Server: https://sairo.example.com
    User: admin (admin)
    Session: expires in 23h 14m
    Version: 2.0.0
    S3: https://s3.amazonaws.com (connected, 12ms)
    BUCKETS OBJECTS TOTAL SIZE LAST CRAWL
    ─────── ─────── ────────── ──────────
    4 134,707 38.2 TB 2m ago
Terminal window
# List all buckets
sairo ls
# List objects in a bucket
sairo ls my-bucket/logs/ -l
# Recursive listing (all objects under a prefix)
sairo ls my-bucket/data/ -r --sort size
Terminal window
# Search across a bucket — returns in milliseconds
sairo search my-bucket "parquet"
# Search within a specific prefix
sairo search my-bucket "config" --prefix settings/
Terminal window
# Download a file
sairo get my-bucket/reports/summary.pdf ./
# Upload a file
sairo put ./data.csv my-bucket/uploads/
# Recursive download
sairo get my-bucket/exports/ ./local-dir/ -r
Terminal window
# Disk usage breakdown
sairo du my-bucket -d 1
# Object metadata
sairo info my-bucket/data/events.parquet
# Directory tree
sairo tree my-bucket/logs/ -d 2 --size
Terminal window
# Preview file contents
sairo cat my-bucket/config/app.yaml
# Generate a presigned URL
sairo presign my-bucket/reports/summary.pdf --expires 86400
# Server-side copy
sairo cp my-bucket/a.txt my-bucket/b.txt
# Delete with confirmation
sairo rm my-bucket/old-data/ -r

Every command supports --json for machine-readable output. JSON mode is auto-enabled when stdout is piped.

Terminal window
# Explicit JSON
sairo ls my-bucket/ --json | jq '.files[] | .key'
# Auto-detected (pipe)
sairo search my-bucket "parquet" | jq .

Manage connections to multiple Sairo instances:

Terminal window
# Login with a named profile
sairo login https://staging.example.com --profile staging
# Use a specific profile
sairo ls my-bucket/ --profile staging
# Switch default profile
sairo login https://production.example.com --profile production

For CI/CD pipelines, use API tokens instead of interactive login:

Terminal window
# Login with a token
sairo login https://sairo.example.com --token sairo_abc123...
# Or use an environment variable
export SAIRO_TOKEN=sairo_abc123...
sairo ls my-bucket/

The CLI queries Sairo’s indexed backend, not S3 directly. On a production bucket with 134K+ objects:

Operationmc / aws s3sairoSpeedup
List top-level folder~3 min0.05s3,000x+
Recursive list (134K objects)~12 min4.8s150x
Search by filename3+ min0.08s2,000x+
Storage breakdown3+ min0.03s6,000x+