Skip to main content

# Terminal Access

You can open an interactive terminal connected directly to the task's container. This lets you run commands, explore the filesystem, resume agents, and debug issues in real-time.

## Web-Based Terminal​

Click the Terminal button in the task toolbar to open a terminal in a new browser tab. You're immediately connected to the running container and can execute commands.

The web-based terminal supports:

- Full shell capabilities (bash)
- Running commands and tools installed in the container
- Interactive prompts and text input
- Colors and text formatting
- Standard input/output redirection

This is the quickest way to access the container—no local setup required.

## Attaching from Your Own Terminal​

If you prefer using your local terminal application, click the dropdown arrow next to the Terminal button and select Copy Attach Command. This copies a `coder` CLI command to your clipboard.

Paste and run this command in your local terminal to attach directly to the container. This gives you:

- Your preferred terminal emulator and configuration
- Better keyboard shortcut support
- Integration with local tools and shell customizations
- Easier copy/paste workflows

The attach command connects to the same container as the web terminal—both access the identical environment.

Note: Terminal access is only available while the container is running. If the container stops, restart it to use the terminal again.

## Working in the Container​

The container environment has a specific structure:

- `/workspace` - The main working directory where repositories are cloned. This is where you'll spend most of your time. All repository code, configurations, and edits live here.
- `/task-output` - Output directory containing task metadata, logs, and state information. This is managed by the system.

When you open a terminal, it starts in the `/workspace` directory by default. All code changes you make here (whether through file editing or terminal commands) are reflected in the Changed Files section after syncing.

### Environment Setup​

The container includes:

- Pre-installed AI agent runtimes (Claude Code, Codex, Gemini, Bob Shell, Grok Build, etc.)
- Git configured for the workspace
- Development tools (Node.js, Python, etc.)
- SSH and other utilities for advanced workflows

## Common Operations​

### Run a Shell Command​

    # Any bash command works as normal
    ls -la
    grep -r "search-term" .
    npm install
    python script.py

### Resume an AI Agent​

The terminal dropdown menu provides quick shortcuts to resume agents:

    # Resume Claude Code from the last session
    claude resume

    # Resume Codex from the last session
    codex resume

    # Start a new Claude Code session
    claude exec

These commands automatically set up the necessary environment and load previous session state if available.

### Apply a Patch Locally​

If you want to apply the current task's patch to a local repository on your machine, use the CLI (not in the terminal):

    # From your local machine
    coder apply <task-id> <filename>

This is useful if you prefer to review and integrate changes in your local development environment.

### Explore the Workspace​

    # See what repositories are available
    ls /workspace

    # View repository status
    cd /workspace/<repo-name>
    git status

    # See recent commits
    git log --oneline -10

### Interact with the Agent​

When an agent is running, you can:

- Inspect what it's doing with logs
- Check intermediate results in `/task-output`
- Modify files and re-run commands to guide the agent

All changes made in the terminal contribute to the final diff and appear in the Changed Files section.