CtrlOps
|Docs
Product Modules

AI Terminal

Using the AI-powered terminal for intelligent command assistance, troubleshooting, and automation with support for multiple AI providers.

The AI Terminal combines traditional SSH terminal access with artificial intelligence to help you troubleshoot, learn, and execute commands safely. Connect to OpenAI, Anthropic, Gemini, or your own custom AI provider.

AI Flow Architecture

Provider Support

| Model | Best For | Context Window | |-------|----------|----------------| | GPT-4o | General purpose, fast | 128K tokens | | GPT-4 | Complex reasoning | 8K tokens | | GPT-3.5 Turbo | Simple queries, cost-effective | 16K tokens | Setup: Add your OpenAI API key in Settings → AI Keys

| Model | Best For | Context Window | |-------|----------|----------------| | Claude 3.5 Sonnet | Technical tasks, coding | 200K tokens | | Claude 3 Opus | Complex analysis | 200K tokens | | Claude 3 Haiku | Quick responses | 200K tokens | Setup: Add your Anthropic API key in Settings → AI Keys

| Model | Best For | Context Window | |-------|----------|----------------| | Gemini 1.5 Pro | Long context, multimodal | 1M tokens | | Gemini 1.5 Flash | Fast responses | 1M tokens | Setup: Add your Google AI Studio API key in Settings → AI Keys

Connect any OpenAI-compatible API endpoint: - Local models (Ollama, LM Studio) - Corporate AI gateways - Other providers with OpenAI-style API Setup: Configure base URL and API key in Settings → AI Keys

Response Classification

The AI classifies all responses into categories for safe handling:

Prop

Type

Classification Types

What Makes It Different?

Unlike a regular terminal, the AI Terminal:

  • Suggests commands based on your goal
  • Explains errors in plain English
  • Generates scripts for complex tasks
  • Checks commands before execution
  • Supports multiple AI providers — Choose your preferred AI

Getting Started

Opening the Terminal

  1. Connect to a server
  2. Click the "Terminal" tab
  3. Start typing or ask the AI for help

Basic Interface

┌─────────────────────────────────────────┐
│  username@server:~$                     │
│                                         │
│  [Your command output appears here]     │
│                                         │
│  Ask AI: "How do I check disk space?"   │
└─────────────────────────────────────────┘

Using the AI Assistant

Natural Language Queries

Type your question naturally:

You: My website is slow, what should I check?

AI: Let me help you diagnose performance issues. I'll check:
1. CPU usage
2. Memory consumption
3. Disk I/O
4. Running processes

Suggested command:
$ top -bn1 | head -20

Would you like me to run this? [Run] [Explain more]

Command Explanation

Highlight any command to understand what it does:

$ find /var/log -name "*.log" -mtime +7 -delete

AI Explanation:

This command finds log files older than 7 days and deletes them:

  • find — searches for files
  • /var/log — looks in the logs directory
  • -name "*.log" — finds files ending in .log
  • -mtime +7 — files modified more than 7 days ago
  • -delete — removes the files

⚠️ Warning: This permanently deletes files without confirmation!

Auto-Run Mode

Enable Auto-Run to let the AI execute commands automatically for safe operations:

Auto-Run only executes read-only or low-risk commands. Dangerous operations always require your approval.

Technical Implementation

Prompt Engineering

CtrlOps uses sophisticated prompt engineering to get the best results:

// System prompt structure
const systemPrompt = `
You are a Linux system administration expert helping via SSH terminal.
Current server: ${hostname}
User: ${username}
Working directory: ${pwd}

Rules:
1. Prefer safe, read-only commands for initial diagnosis
2. Explain commands before suggesting destructive operations
3. Use precise syntax for the detected shell (${shell})
4. Consider the user's apparent skill level
5. Suggest alternatives when possible

Respond with either:
- A command to execute (prefixed with $)
- An explanation or answer in natural language
`;

Context Management

The AI receives context to provide relevant help:

interface AiContext {
  // Server information
  hostname: string;
  os: "ubuntu" | "centos" | "debian" | "amazon-linux";
  architecture: "x64" | "arm64";

  // Session state
  currentDirectory: string;
  recentCommands: string[];
  environmentVariables: Record<string, string>;

  // User preferences
  expertiseLevel: "beginner" | "intermediate" | "expert";
  preferredShell: "bash" | "zsh" | "fish";
}

Safety Classification

Before executing any command, the system classifies risk level:

type RiskLevel = "SAFE" | "CAUTION" | "DESTRUCTIVE";

const riskIndicators = {
  SAFE: ["ls", "cat", "ps", "top", "df", "du", "grep", "echo"],
  CAUTION: ["systemctl restart", "kill", "pkill", "chmod"],
  DESTRUCTIVE: [
    "rm -rf",
    "dd",
    "mkfs",
    "fdisk",
    "parted",
    "DROP DATABASE",
    "DELETE FROM",
    "TRUNCATE",
  ],
};

function classifyRisk(command: string): RiskLevel {
  // Implementation checks against risk indicators
  // Returns appropriate risk level
}

Practical Examples

Example 1: Debugging a Failed Service

You: nginx failed to start

AI: Let me check what's wrong with nginx.

[Running]: systemctl status nginx

● nginx.service - A high performance web server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
   Active: failed (Result: exit-code)

Error: Port 80 is already in use!

Suggested fix:
1. Check what's using port 80
2. Stop the conflicting service
3. Restart nginx

[Check port 80] [Show me how to fix]

Example 2: Setting Up a Database

You: Install PostgreSQL and create a database

AI: I'll help you install PostgreSQL and set up a database.

Step 1: Install PostgreSQL
$ sudo apt update && sudo apt install postgresql postgresql-contrib

Step 2: Start the service
$ sudo systemctl start postgresql

Step 3: Create database
$ sudo -u postgres createdb myapp

Step 4: Create user
$ sudo -u postgres createuser -P myuser

Would you like me to execute these steps? [Execute all] [Step by step]

Example 3: Analyzing Logs

You: Find all 404 errors in nginx logs from today

AI: I'll search for 404 errors in today's nginx access logs.

Command:
$ grep "$(date +%d/%b/%Y)" /var/log/nginx/access.log | grep " 404 "

Results:
192.168.1.100 - - [13/Apr/2026:10:15:32 +0000] "GET /missing-page.html HTTP/1.1" 404 564
192.168.1.101 - - [13/Apr/2026:11:22:15 +0000] "GET /old-link.php HTTP/1.1" 404 564

Summary: Found 2 requests resulting in 404 errors.

Command Safety Features

Approval Required

The AI will ask for confirmation before:

  • Deleting files or directories
  • Modifying system configurations
  • Stopping critical services
  • Running commands with sudo
  • Database operations

Dry Run Mode

Preview what a command will do before executing:

You: Delete old log files

AI: I'll help you clean up old logs. Let me show what will be deleted:

[Dry Run Results]:
Would delete: /var/log/app/old.log (2.3 MB, 45 days old)
Would delete: /var/log/nginx/access.log.2.gz (156 MB, 60 days old)
Total space to free: 158.3 MB

[Execute] [Cancel] [Show me the command first]

Rollback Capability

Many operations create backups automatically:

  • Configuration file changes
  • Package installations
  • Service modifications

Restore with: ctrlops rollback

Iteration Limits

Free tier: 100 AI queries per month Pro tier: Unlimited queries

Track your usage in Settings > AI Usage

Keyboard Shortcuts

ShortcutAction
Ctrl + LClear screen
Ctrl + AAsk AI (opens prompt)
Ctrl + RSearch command history
TabAutocomplete
/ Navigate history

Tips for Best Results

Be Specific

❌ "Fix my server" ✅ "MySQL is using 90% CPU, how do I find slow queries?"

Provide Context

❌ "Check logs" ✅ "Check nginx error logs for the last hour for any PHP errors"

Ask for Explanation

Add "explain" to your query:

  • "Explain how disk partitioning works"
  • "Show me what this Docker command does"

Use Safe Language

The AI understands safety terms:

  • "Safely restart"
  • "Check without changing"
  • "Preview before executing"

Troubleshooting AI Terminal

"AI not responding"

  • Check internet connection
  • Verify API key in Settings
  • Check iteration limits

"Command not found"

  • The AI suggested a command not installed
  • Ask: "How do I install [tool]?"

"Permission denied"

  • Try with sudo
  • Check user permissions
  • Ask AI: "How to grant permission for this?"

Next Steps

On this page