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

# CLI Overview

> A reference for the Nx command-line interface, including all major commands and global flags.

The Nx CLI (`nx`) is the primary interface for running tasks, generating code, managing migrations, and visualizing your workspace. Every command follows the pattern:

```bash theme={null}
nx <command> [options]
```

## Getting help

Pass `--help` to any command to see its options and usage:

```bash theme={null}
nx --help
nx run --help
nx affected --help
```

To list available generators for a plugin:

```bash theme={null}
nx list @nx/react
```

## Commands

<CardGroup cols={2}>
  <Card title="run" icon="play" href="/reference/cli/run">
    Run a single target for a project. Supports configuration overrides and cache control.
  </Card>

  <Card title="generate" icon="wand-sparkles" href="/reference/cli/generate">
    Scaffold or update source code using a generator from any installed Nx plugin.
  </Card>

  <Card title="affected" icon="git-branch" href="/reference/cli/affected">
    Run a target only for projects that are affected by recent changes in your git history.
  </Card>

  <Card title="run-many" icon="layers" href="/reference/cli/run-many">
    Run one or more targets across a specific set of projects in the workspace.
  </Card>

  <Card title="migrate" icon="arrow-up-circle" href="/reference/cli/migrate">
    Update Nx and its plugins, and apply the resulting code migrations automatically.
  </Card>

  <Card title="release" icon="package" href="/reference/cli/release">
    Orchestrate versioning, changelog generation, and publishing of packages.
  </Card>

  <Card title="graph" icon="share-2" href="/reference/cli/graph">
    Visualize the project dependency graph or task graph in an interactive browser UI.
  </Card>
</CardGroup>

## Other commands

| Command                  | Description                                          |
| ------------------------ | ---------------------------------------------------- |
| `nx add <plugin>`        | Add an Nx plugin to the workspace                    |
| `nx init`                | Initialize Nx in an existing repository              |
| `nx list`                | List installed plugins and available generators      |
| `nx show project <name>` | Show configuration and targets for a project         |
| `nx sync`                | Run sync generators to keep the workspace consistent |
| `nx repair`              | Repair the workspace configuration                   |
| `nx reset`               | Clear the local Nx cache                             |
| `nx report`              | Report Nx version and environment information        |
| `nx format:write`        | Format workspace files using Prettier                |
| `nx format:check`        | Check that workspace files are formatted             |
| `nx watch`               | Watch for file changes and re-run a target           |
| `nx exec`                | Execute a shell command for each project             |
| `nx connect`             | Connect to Nx Cloud                                  |

## Global flags

These flags are accepted by most Nx commands.

<ParamField query="--verbose" type="boolean">
  Prints additional information about the commands (e.g., stack traces). Also enabled by setting `NX_VERBOSE_LOGGING=true`.
</ParamField>

<ParamField query="--version" type="boolean">
  Print the current version of Nx and exit.
</ParamField>

<ParamField query="--help" type="boolean">
  Show help for the command and exit.
</ParamField>

## Environment variables

| Variable                  | Description                                                               |
| ------------------------- | ------------------------------------------------------------------------- |
| `NX_VERBOSE_LOGGING`      | Set to `true` to enable verbose logging globally                          |
| `NX_PARALLEL`             | Default number of parallel tasks (overridden by `--parallel`)             |
| `NX_DEFAULT_OUTPUT_STYLE` | Default output style for task runs                                        |
| `NX_INTERACTIVE`          | Set to `false` to disable interactive prompts in generators               |
| `NX_DRY_RUN`              | Set to `true` to enable dry-run mode for generators                       |
| `NX_TUI`                  | Set to `true` or `false` to force-enable or force-disable the Terminal UI |
| `NX_TUI_AUTO_EXIT`        | Controls automatic TUI exit behavior after tasks finish                   |
