---
title: Clear
description: Clear and reset your commands, both globally and per guild
---

```sh
Usage: sern commands clear [options]

Clear and reset commands-data-remote.json and the api

Options:
  -y, --yes         Say yes to all prompts
  -e, --env [path]  Supply a path to a .env
  -h, --help        display help for command
```

## Introduction

The clear command is a utility that resets all of your commands. It's useful if you accidentally publish the wrong command, such as publishing a guild command globally.

The clear command works by sending an empty array via the [`PUT`](https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands) route to the Discord API, for each guild and globally.

To use this command, ensure you have a proper `.env` file in your root directory:

```sh title=".env"
DISCORD_TOKEN=<YOUR_TOKEN>
NODE_ENV=<development|production>
```

## Usage

```sh
sern commands clear
```

## Notes

- The clear command will prompt you to confirm the action. You can bypass this by using the `-y` flag.
- The clear command will automatically read a `.env` file in the working directory. If you need to override this, you can use the `-e` flag to supply a path to a different `.env` file.
