> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fermion.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Execute Commands inside your Sandbox

> Execute short, non-streaming commands within a Fermion Sandbox and return stdout and stderr once complete.

The `runCommand()` method executes a single short-lived command inside your active sandbox container and waits until it finishes before returning the output. It’s ideal for quick tasks that complete within a few seconds: such as listing directories, checking Node.js or Python versions, or running lightweight scripts.

This method runs the command synchronously and captures both `stdout` and `stderr` once the execution is complete. Because it is optimized for speed and simplicity, `runCommand()` has a strict 5-second execution limit and does not support streaming output.

### `runCommand(options)`

**Description:**
Executes a short command (\< 5 seconds) and waits for completion. For longer operations, use `runStreamingCommand()`.

**Parameters:**

| Parameter | Type      | Required | Description                                       |
| --------- | --------- | -------- | ------------------------------------------------- |
| cmd       | string    | Yes      | Command to execute (e.g., 'node', 'python', 'ls') |
| args      | string\[] | No       | Array of command arguments                        |

**Returns:**

```typescript theme={null}
Promise<{
  stdout: string  // Standard output
  stderr: string  // Standard error
}>
```

**Example:**

```typescript theme={null}
// Simple command
const result = await sandbox.runCommand({
  cmd: 'pwd'
})
console.log('Current dir:', result.stdout)
```

**Limitations:**

* **5 second maximum** : Command will timeout
* No streaming - must wait for completion
* No exit code returned (use `runStreamingCommand` if you need it)
