This may not be known to a lot of people but half the bench commands we're used to, exist in the Frappe Framework and not in bench directly. Those commands generally are the `--site` commands. This page is concerned only with the commands in the bench project. Any framework commands won't be a part of this consolidation.
# bench CLI Commands
Under Click's structure, `bench` is the main command group, under which there are three main groups of commands in bench currently, namely
- **install**: The install command group deals with commands used to install system dependencies for setting up Frappe environment
- **setup**: This command group for consists of commands used to maipulate the requirements and environments required by your Frappe environment
- **config**: The config command group deals with making changes in the current bench (not the CLI tool) configuration
## Using the bench command line
```zsh
➜ bench
Usage: bench [OPTIONS] COMMAND [ARGS]...
Bench manager for Frappe
Options:
--version
--help Show this message and exit.
Commands:
backup Backup single site
backup-all-sites Backup all sites in current bench
config Change bench configuration
disable-production Disables production environment for the bench.
get-app Clone an app from the internet or filesystem and...
```
Similarly, all available flags and options can be checked for commands individually by executing them with the `--help` flag. The `init` command for instance:
```zsh
➜ bench init --help
Usage: bench init [OPTIONS] PATH
Initialize a new bench instance in the specified path
Options:
--python TEXT Path to Python Executable.
--ignore-exist Ignore if Bench instance exists.
--apps_path TEXT path to json files with apps to install
after init
```
## bench and sudo
Some bench commands may require sudo, such as some `setup` commands and everything else under the `install` commands group. For these commands, you may not be asked for your root password if sudoers setup has been done. The security implications, well we'll talk about those soon.
## General Commands
These commands belong directly to the bench group so they can be invoked directly prefixing each with `bench` in your shell. Therefore, the usage for these commands is as
- **init**: Initialize a new bench instance in the specified path. This sets up a complete bench folder with an `apps` folder which contains all the Frappe apps available in the current bench, `sites` folder that stores all site data seperated by individual site folders, `config` folder that contains your redis, NGINX and supervisor configuration files. The `env` folder consists of all python dependencies the current bench and installed Frappe applications have.
- **restart**: Restart web, supervisor, systemd processes units. Used in production setup.
- **update**: If executed in a bench directory, without any flags will backup, pull, setup requirements, build, run patches and restart bench. Using specific flags will only do certain tasks instead of all.
- **renew-lets-encrypt**: Renew Let's Encrypt certificate for site SSL.
- **backup**: Backup single site data. Can be used to backup files as well.
- **backup-all-sites**: Backup all sites in current bench.
- **get-app**: Download an app from the internet or filesystem and set it up in your bench. This clones the git repo of the Frappe project and installs it in the bench environment.
- **remove-app**: Completely remove app from bench and re-build assets if not installed on any site.
- **exclude-app**: Exclude app from updating during a `bench update`
- **include-app**: Include app for updating. All Frappe applications are included by default when installed.
- **prepare-beta-release**: Prepare major beta release from develop branch
## Setup commands
The setup commands used for setting up the Frappe environment in context of the current bench need to be executed using `bench setup` as the prefix. So, the general usage of these commands is as
- **manager**: Setup `bench-manager.local` site with the [Bench Manager](https://github.com/frappe/bench_manager) app, a GUI for bench installed on it.
- **production**: Setup Frappe production environment for specific user. This installs ansible, NGINX, supervisor, fail2ban and generates the respective configuration files.