---
url: /guide/basic-commands/clean-targets.md
---
# Clean Targets {#clean-targets}

We can use the `xmake clean` command to clean up the generated files during the build process.

For details on building targets, see [Build Targets](/guide/basic-commands/build-targets).

## Command format

```sh
$ xmake clean [options] [target]
```

## Clean the target

If no target name is specified, all targets will be cleaned by default.

```sh
$ xmake clean
```

We can also specify to clean a specific target.

```sh
$ xmake clean test
```

## Clean all files

By default, `xmake clean` only cleans the object files and target files generated by the current build mode (e.g., debug/release) and architecture.

If you want to clean all files generated by all compilation modes and architectures, you can verify:

```sh
$ xmake clean -a
```

or

```sh
$ xmake clean --all
```

## Clean configuration

If you want to clear the configuration cache (re-execute detection and configuration), you can verify:

```sh
$ xmake f -c
```
