Skip to main content

Frappe Commands

The Bench CLI uses the frappe.utils.bench_manager module to load commands provided by the Frappe Framework and installed applications. This guide covers the commands that are part of the Frappe Framework and are executed through Bench CLI.

Note:

Many Bench CLI commands are implemented by the Frappe Framework. Commands that work on a specific site typically support the --site option.

Command Categories

Frappe commands available through Bench CLI are grouped into the following categories:

  • Site Commands
  • Database Maintenance Commands
  • Scheduler Commands
  • Frappe Utility Commands
  • Translation Commands

Site Commands

Site commands are used to create, manage, update, and maintain individual Frappe sites. Most of these commands are executed with the --site option.

Create a Site

bench new-site {site}

Creates a new site with the Frappe Framework installed.

Backup a Site

bench --site {site} backup

Creates database and file backups. Older backup files are automatically cleaned up.

Restore a Site

bench --site {site} restore path/to/database.sql.gz

Restores a site from an SQL or compressed SQL backup file.

Partial Backup and Restore

From Version 13 onwards, Bench supports partial backups and partial restores for selected data.

Install an App

bench --site {site} install-app {app}

Installs a Frappe application on the specified site.

Uninstall an App

bench --site {site} uninstall-app {app}

Removes an application and its associated data from the site after creating a backup.

Important:

App uninstallation permanently removes application data from the site.

Migrate a Site

bench --site {site} migrate

Runs database patches, synchronizes the schema, rebuilds assets, and updates indexes.

Delete a Site

bench drop-site {site}

Deletes the site’s database and archives the site directory.

Reinstall a Site

bench reinstall {site}

Resets the site by reinstalling all installed applications.

List Installed Apps

bench --site {site} list-apps

Displays all applications installed on the selected site.

Set Default Site

Instead of specifying --site repeatedly, set the environment variable:

export FRAPPE_SITE=mysite.localhost

Open a Site in Browser

bench browse site.local

bench --site site.local browse

bench --site site.local browse --user Administrator

Launches the selected site directly in your default browser.

Additional Site Commands

  • add-system-manager
  • add-user
  • add-to-hosts
  • build-search-index
  • disable-user
  • publish-realtime
  • reload-doc
  • reload-doctype
  • remove-from-installed-apps
  • run-patch
  • migrate-to
  • ngrok
  • set-password
  • set-admin-password
  • set-last-active-for-user
  • start-recording
  • stop-recording
  • use

Database Maintenance Commands

Database maintenance commands help optimize and manage database storage.

Transform Database Tables

bench --site {site} transform-database --tables {tables}

Changes table engine or row format.

Trim Database Tables

bench trim-tables

Removes unused columns left after DocField deletions.

Trim Database

bench trim-database

Deletes unused database tables created by removed DocTypes.

Scheduler Commands

Scheduler commands manage background workers and scheduled jobs.

  • disable-scheduler
  • doctor
  • enable-scheduler
  • purge-jobs
  • ready-for-migration
  • scheduler
  • set-maintenance-mode
  • show-pending-jobs
  • schedule
  • worker
  • trigger-scheduler-event

Frappe Utility Commands

Show Site Configuration

bench --site {site} show-config

Displays the merged configuration from both site_config.json and common_site_config.json.

Update Site Configuration

bench --site {site} set-config KEY VALUE

Adds or updates configuration values.

Show Installed App Versions

bench version

Displays installed applications and their versions.

Other Utility Commands

  • build
  • bulk-rename
  • clear-cache
  • clear-website-cache
  • console
  • data-import
  • destroy-all-sessions
  • execute
  • export-csv
  • export-doc
  • export-fixtures
  • export-json
  • import-csv
  • import-doc
  • jupyter
  • make-app
  • db-console
  • mariadb
  • postgres
  • rebuild-global-search
  • request
  • reset-perms
  • run-tests
  • run-parallel-tests
  • run-ui-tests
  • serve
  • watch

Translation Commands

Bench supports both traditional CSV-based translations and GNU Gettext PO file translations.

CSV Translation Commands

  • build-message-files
  • get-untranslated
  • migrate-translations
  • new-language
  • update-translations

Gettext (PO) Translation Commands

  • generate-pot-file
  • compile-po-to-mo
  • migrate-csv-to-po
  • update-po-files
  • create-po-file
Tip:

Starting with Frappe Version 16, PO-based translations are the recommended approach for managing multilingual applications.

Rating: 0 / 5 (0 votes)