Skip to main content

Printable Bench CLI Cheatsheet

The Bench CLI Cheatsheet provides a quick reference to the most commonly used Bench commands.
It’s designed as an A4 printable guide so developers can keep important commands within easy reach
while working with Frappe and ERPNext projects.

Tip: Print the cheatsheet and keep it at your workspace for quick access to frequently used Bench commands.

General Usage

Bench provides several commands to inspect your environment, initialize new benches, update existing
installations, create backups, restore sites, and manage migrations. These commands are the foundation
of daily Frappe development and administration.

Bench Information Commands

Command Description
bench --version Display the installed Bench CLI version.
bench version Show the versions of Bench, Frappe, ERPNext, and all installed applications.
bench src Display the location of the Bench source repository.
bench --help List all available Bench commands.
bench [command] --help Show detailed help for a specific command.

Initialize a New Bench

Use the following command to create a new Bench environment from your home directory.

bench init [bench-name]

Available Options

Option Purpose
--python Specify the Python executable to use.
--ignore-exist Continue even if the Bench directory already exists.
--apps_path Install applications listed inside a JSON file after initialization.
--frappe-path Clone Frappe from a custom repository.
--frappe-branch Clone a specific Frappe branch.
--clone-from Reuse repositories from an existing Bench.
--clone-without-update Copy repositories without updating them.
--no-procfile Skip generating the Procfile.
--no-backups Disable automatic backups during initialization.
--no-auto-update Disable automatic Bench updates.
--skip-redis-config-generation Skip Redis configuration generation.
--verbose Display detailed installation logs.
Note: Run bench init from your home directory instead of inside another Bench instance.

Running Commands for a Specific Site

bench --site [site-name] COMMAND

This option executes a Bench command for a particular site when multiple sites exist within the same Bench.

Updating a Bench

bench update

The update command pulls the latest code, applies database patches, rebuilds assets, and runs migrations
across installed applications.

Common Update Options

Option Description
--pull Pull the latest changes from Git repositories.
--patch Run only database patches.
--build Rebuild JavaScript and CSS assets.
--bench Update the Bench CLI itself.
--requirements Update Python and Node dependencies.
--restart-supervisor Restart Supervisor-managed services after updating.
--no-backup Skip automatic backups before update.
--reset Discard local changes before updating.
--dev Enable developer mode and install development dependencies.

Restart Bench Services

bench restart

Restarts all Bench services including web workers, Redis instances, scheduler, and background workers.

Create a Backup

bench backup

Creates a backup of the default site. Backup files are stored inside:

~/frappe-bench/sites/{site-name}/private/backups/

Backup All Sites

bench backup-all-sites --with-files

Creates backups for every site in the Bench, including uploaded files when the
--with-files option is used.

Restore a Backup

bench restore

Available restore options include:

  • --with-private-files
  • --with-public-files

Run Database Migration

bench migrate

Applies database patches, synchronizes the schema, updates translations, and rebuilds website assets.

Migrate Python Environment

bench migrate-env [python-version]

Migrates the virtual environment to a newer Python version.

Reset Administrator Password

bench --site [sitename] set-admin-password [password]

Destroy All Sessions

bench destroy-all-sessions

Logs out every active user by destroying all active sessions.

Rating: 0 / 5 (0 votes)