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

# exec

> Run a command in an environment.

```bash theme={null}
envctl exec [--timeout N] [--no-sync] [--dir path] <environment> -- <command> [args...]
```

Syncs your shares, runs the command in the environment over the tailnet, streams its output, waits for results coming back, and exits with the command's exit code.

| Flag | Default | Description |
| - | - | - |
| `--timeout N` | no limit | Stop the command after N seconds; envctl exits with 124 |
| `--no-sync` | | Don't sync shares before running |
| `--dir path` | the template's working directory | Run from this folder in the environment |

The command isn't run through a shell: use `sh -c '…'` for pipes and `&&`. See [Run commands](/guides/exec) for the details.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.