# Bench CLI Reference
## App & site lifecycle
```bash
# New app (MUST pipe input — no heredoc, no --no-input)
printf '
\n\n\n\n\nN\nN\nN\n' | bench new-app
# New site (set root_password in common_site_config first: bench set-config -g root_password '')
bench new-site .localhost --admin-password admin
# Install/uninstall app
bench --site install-app
bench --site uninstall-app
# List apps on site
bench --site list-apps
# Migrate (apply schema + data changes)
bench --site migrate
# Set default site
bench use
```
## Development
```bash
# Start dev server (run in BACKGROUND)
bench start
# Developer mode
bench set-config -g developer_mode 1
# Python console with site context
bench --site console
# Execute a Python expression
bench --site execute frappe.utils.get_url
# Execute with args and kwargs
bench --site execute path.to.function arg1 arg2 --kwarg1 hello
# Run tests
bench --site run-tests --app
bench --site run-tests --doctype "DocType Name"
# Build frontend assets
bench build --app
# Watch mode for frontend
bench watch
```
## Site maintenance
```bash
# Backup
bench --site backup
# Restore
bench --site restore
# Clear cache
bench --site clear-cache
bench --site clear-website-cache
# Set site config
bench --site set-config
# Global config
bench set-config -g
# MariaDB console (debugging only)
bench --site mariadb
# Drop site (DESTRUCTIVE)
bench drop-site --db-root-password ''
```
## Fixtures
```bash
# Export fixtures defined in hooks.py
bench --site export-fixtures --app
```