---
title: run
---

import VersionLabel from '@site/src/components/Docs/VersionLabel';

The `moon run` (or `moon r`) command will run one or many [targets](../concepts/target) and all of
its dependencies in topological order. Each run will incrementally cache each task, improving speed
and development times... over time. View the official [Run a task](../run-task) and
[Cheat sheet](../cheat-sheet#tasks) articles for more information!

```shell
# Run `lint` in project `app`
$ moon run app:lint

# Run `dev` in project `client` and `server`
$ moon run client:dev server:dev

# Run `test` in all projects
$ moon run :test

# Run `test` in the closest project, relative to the current working directory
$ moon run '~:test'

# Run `test` in all projects with tag `frontend`
$ moon run '#frontend:test'

# Run `format` in default project
$ moon run format

# Run `build` in projects matching the query
$ moon run :build --query "language=javascript && projectLayer=library"
```

:::info

The default behavior for `moon run` is to "fail fast", meaning that any failed task will immediately
abort execution of the entire action graph. Use `moon exec --on-failure continue` for alternative
behavior.

:::

### Arguments

- `...<target>` - [Targets](../concepts/target) or project relative tasks to run.
- `[-- <args>]` - Additional arguments to
  [pass to the underlying command](../run-task#passing-arguments-to-the-underlying-command).

### Options

Inherits all options from [`moon exec`](./exec) and pre-fills with: `--on-failure=bail`,
`--upstream=deep`.

- `query` - Filter tasks based on the result of a query.

### Configuration

- [`projects`](../config/workspace#projects) in `.moon/workspace.*`
- [`tasks`](../config/tasks#tasks) in `.moon/tasks/*`
- [`tasks`](../config/project#tasks) in `moon.*`
