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

# Running commands in sandbox

You can run terminal commands inside the sandbox using the `commands.run()` method.

```js JavaScript & TypeScript theme={"theme":"css-variables"}
import { Sandbox } from 'e2b'

const sandbox = await Sandbox.create()
const result = await sandbox.commands.run('ls -l')
console.log(result)
```

```python Python theme={"theme":"css-variables"}
from e2b import Sandbox

sandbox = Sandbox.create()
result = sandbox.commands.run('ls -l')
print(result)
```

## Custom shell

By default, commands run in a Bash login shell (`/bin/bash -l -c <cmd>`). Pass the `shell` option to run the command with a different executable and arguments; the command is appended as the last argument.

```js JavaScript & TypeScript highlight={5} theme={"theme":"css-variables"}
import { Sandbox } from 'e2b'

const sandbox = await Sandbox.create()
const result = await sandbox.commands.run('print(6 * 7)', {
  shell: ['python3', '-c'], // Runs `python3 -c 'print(6 * 7)'`
})
console.log(result.stdout) // 42
```

```python Python highlight={4} theme={"theme":"css-variables"}
from e2b import Sandbox

sandbox = Sandbox.create()
result = sandbox.commands.run('print(6 * 7)', shell=['python3', '-c'])  # Runs `python3 -c 'print(6 * 7)'`
print(result.stdout)  # 42
```
