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

# Opdrachten uitvoeren in sandbox

export const SandboxCliConfigHint = () => {
  if (typeof document === "undefined") {
    return null;
  } else {
    return <Note>Before running the command-line related example code in this document, please refer to the <Link href="/docs/nl/guides/sandbox-cli">tutorial</Link> to install the CLI and complete <Link href="/docs/nl/guides/sandbox-cli-auth">authentication</Link>.</Note>;
  }
};

<SandboxCliConfigHint />

U kunt opdrachten uitvoeren in een draaiende sandbox en de uitvoer ervan ontvangen met de volgende opdracht.

```bash Bash icon="terminal" theme={"system"}
novita-sandbox-cli sandbox exec <sandbox-id> <command>
```

### Uitvoeringsopties

Met de `--background`-vlag kunt u een opdracht op de achtergrond uitvoeren en onmiddellijk terugkeren. De opdracht drukt de proces-ID (PID) af naar stderr:

```bash Bash icon="terminal" theme={"system"}
novita-sandbox-cli sandbox exec --background <sandbox-id> "sleep 60 && echo done"
```

De `--cwd`-vlag geeft de werkmap voor de opdracht op.

```bash Bash icon="terminal" theme={"system"}
novita-sandbox-cli sandbox exec --cwd /home/user <sandbox-id> ls
```

De `--user`-vlag geeft de gebruiker op waarmee de opdracht wordt uitgevoerd.

```bash Bash icon="terminal" theme={"system"}
novita-sandbox-cli sandbox exec --user root <sandbox-id> apt-get update
```

Met de `--env`-vlag kunt u omgevingsvariabelen instellen. Herhaal de vlag om meerdere variabelen in te stellen.

```bash Bash icon="terminal" theme={"system"}
novita-sandbox-cli sandbox exec --env NODE_ENV=production --env DEBUG=true <sandbox-id> node app.js
```
