Bench Commands Cheatsheet
Printable Bench CLI Cheatsheet
Grab a A4 size printable cheatsheet of the most important Bench CLI commands here . Download, print and put it on your desk!
General Usage
bench --version- Show bench version
 bench version- Show version of all apps
 bench src- Show bench repo directory
 bench --help- Show all commands and help
 bench [command] --help- Show help for command
 bench init [bench-name]Create a new bench (Run from home dir)
--python TEXTPath to Python Executable.--ignore-existIgnore if Bench instance exists.--apps_path TEXTpath to json files with apps to install after init--frappe-path TEXTpath to frappe repo--frappe-branch TEXTClone a particular branch of frappe--clone-from TEXTcopy repos from path--clone-without-updatecopy repos from path without update--no-procfilePull changes in all the apps in bench--no-backupsRun migrations for all sites in the bench--no-auto-updateBuild JS and CSS artifacts for the bench--skip-redis-config-generationSkip redis config generation if already specifying the common-site-config file--verboseVerbose output during install
bench --site [site-name] COMMAND- Specify site for command
 bench update- Pulls changes for bench-repo and all apps, applies patches, builds JS and CSS, and then migrates.
--pullPull changes in all the apps in bench--patchRun migrations for all sites in the bench--buildBuild JS and CSS artifacts for the bench--benchUpdate bench--requirementsUpdate requirements--restart-supervisorrestart supervisor processes after update--no-backupDon't take a backup before update--resetIgnore local changes and update
 bench restartRestart all bench servicesbench backupCreate a backup of the default site.
Backup will be saved to
~/frappe-bench/sites/{your site}/private/backups/
.
* bench backup-all-sites
Backup all sites
+ `--with-files`
Backup site with files
* bench restore
Restore
    + --with-private-files
    Restore site with private files (Path to tar file)
    + --with-public-files
    Restore site with public files (Path to tar file)
* bench migrate
Run patches, sync schema and rebuild files/translations
    + --rebuild-website TEXT
    Rebuild webpages after migration
* bench migrate-env [python-version]
Will migrate the virtual environment to the desired python version
* bench --site [sitename] set-admin-password [password]
Will reset the administrator password
* bench destroy-all-sessions
Destroys all sessions
Config
bench config- Change bench configuration
auto_update [on/off]Enable/Disable auto update for benchdns_multitenant [on/off]Enable/Disable DNS Multitenancyhttp_timeoutSet http timeoutrestart_supervisor_on_updateEnable/Disable auto restart of supervisorserve_default_siteConfigure nginx to serve the default site onupdate_bench_on_updateEnable/Disable bench updates on running bench...
 bench setup- Setup components
auto-updateAdd cronjob for bench auto updatebackupsAdd cronjob for bench backupsconfigoverwrite or make config.jsonenvSetup virtualenv for benchnginxgenerate config for nginxprocfileSetup Procfile for bench startproductionsetup bench for productionredisgenerate config for redis cachesocketioSetup node deps for socketio serversudoersAdd commands to sudoers list for execution...supervisorgenerate config for supervisoradd-domainadd custom domain for sitefirewallsetup firewall and block all ports except 22, 80 and 443ssh-portchange the default ssh connection portrequirementsUpdate Python and Node packages--nodeUpdate only Node packages--pythonUpdate only Python packages--devUpdate only Python development dependencies.
 bench set-nginx-port [sitename] [port]- Set site's port in Production
 
Development
bench new-app [app-name]Creates a new appbench get-app [repo-link]- Downloads an app from a git repository and installs it
--branch [branch-name]Fetches specific branch of app
 bench install-app [app-name]Installs existing appbench remove-from-installed-apps [app-name]Remove app from the list of appsbench uninstall-app [app-name]Delete app and everything linked to the app (Bench needs to be running)bench remove-app [app-name]Remove app from the bench entirelybench --site [sitename] --force reinstallReinstall with fresh database (Caution: Will wipe out old database)bench new-site [sitename]- Creates a new site
--db-nameDatabase name--db-hostCustom database host URL for remote connection--db-portCustom database listening port (eg. port other than the default 3306)--mariadb-root-usernameRoot username for MariaDB--mariadb-root-passwordRoot password for MariaDB--admin-passwordAdministrator password for new site--verboseVerbose--forceForce restore if site/database already exists--source_sqlInitiate database with a SQL file--install-appInstall app after installation`
 bench use [site]Sets a default sitebench drop-siteRemoves site from disk and database completely--root-login--root-password
bench set-config [key] [value]Adds a key-value pair to site's config filebench consoleOpens a IPython console in the bench venv--autoreloadReload changes to code automatically
bench executeExecute a method inside any app.- Eg :
bench execute frappe.utils.scheduler.enqueue\_scheduler\_events 
- Eg :
 bench --site [sitename] mariadbOpens SQL Consolebench --site [sitename] export-fixtures [--app TEXT]Export the records defined in the app's hooks as JSON files.bench run-testsRun tests--appApp Name--doctypeDocType to run tests for--testSpecific Test--moduleRun a particular module that has tests--profileRuns a Python profiler on the test
bench disable-productionDisables production environment
Scheduler
bench enable-scheduler- Enables Scheduler that will run scheduled tasks
 bench doctor- Get diagnostic info about background workers
 bench show-pending-jobs- Get pending jobs
 bench purge-jobs- Destroy all pending jobs
 
Data Import
bench data-import- Imports Bulk Data from .csv, .xls or .xlsx
--fileFile Name--doctypeThe DocType--typeInsert/Update