# About dbt clean command

`dbt clean` is a utility function that deletes the paths specified within the [`clean-targets`](../project-configs/clean-targets.md) list in the `dbt_project.yml` file. It helps by removing unnecessary files or directories generated during the execution of other dbt commands, ensuring a clean state for the project.

## Example usage

```text
dbt clean
```

## Supported flags

This section will briefly explain the following flags:

* [`--clean-project-files-only`](#--clean-project-files-only) (default)
* [`--no-clean-project-files-only`](#--no-clean-project-files-only)

To view the list of all supported flags for the `dbt clean` command in the terminal, use the `--help` flag, which will display detailed information about the available flags you can use, including its description and usage:

```shell
dbt clean --help
```

### --clean-project-files-only

By default, dbt deletes all the paths within the project directory specified in `clean-targets`.

note

Avoid using paths outside the dbt project; otherwise, you will see an error.

#### Example usage

```shell
dbt clean --clean-project-files-only
```

### --no-clean-project-files-only

Deletes all the paths specified in the `clean-targets` list of `dbt_project.yml`, including those outside the current dbt project.

```shell
dbt clean --no-clean-project-files-only
```

## dbt clean with remote file system

To avoid complex permissions issues and potentially deleting crucial aspects of the remote file system without access to fix them, this command does not work when interfacing with the RPC server that powers the Studio IDE. Instead, when working in dbt, the `dbt deps` command cleans before it installs packages automatically. The `target` folder can be manually deleted from the sidebar file tree if needed.

## Was this page helpful?

YesNo

[Privacy policy](https://www.getdbt.com/cloud/privacy-policy)[Create a GitHub issue](https://github.com/dbt-labs/docs.getdbt.com/issues)

This site is protected by reCAPTCHA and the Google [Privacy Policy](https://policies.google.com/privacy) and [Terms of Service](https://policies.google.com/terms) apply.
