ICT:Drush
Appearance
Drush: The "Pro" Command-Line Recovery Suite
Note: All commands must be run from the Project Root: /var/www/drupal.
| Command | Purpose | Professional Use Case |
|---|---|---|
./vendor/bin/drush cr |
Cache Rebuild | The first step if the UI looks "wrong" or CSS/JS changes don't appear. |
./vendor/bin/drush uli |
User Login (Emergency) | Generates a one-time secure link to bypass lost passwords or MFA. |
./vendor/bin/drush status |
System Health Check | Verifies the Twin-Server DB connection, PHP version, and MariaDB status. |
./vendor/bin/drush updb |
Update Database | Applies SQL schema changes after a composer update.
|
./vendor/bin/drush cim |
Config Import | Deploys your DBML-to-YAML data model into the live MariaDB schema. |
./vendor/bin/drush cex |
Config Export | Saves your UI changes (Fields/Views) into YAML files for backup in VS Code. |
./vendor/bin/drush watchdog:show |
System Logs | Displays the last 10 errors (DB connection failures, PHP crashes) in the CLI. |
./vendor/bin/drush pm:list |
Module Status | Lists all active extensions (Gin, ECA, etc.) and their current versions. |
Successor Maintenance Workflow
To keep the site "Survival-Ready" for 10+ years, follow this weekly maintenance cycle via the AlmaLinux CLI:
- Check for Updates:
composer outdated drupal/* - Apply Updates:
composer update drupal/core-recommended --with-all-dependencies - Sync Schema:
./vendor/bin/drush updb - Clear Caches:
./vendor/bin/drush cr
Drush Command Reference for Drupal 11
This page provides an overview of commonly used Drush commands for managing a Drupal 11 site. Drush is installed as a Composer dependency and executed from vendor/bin/drush unless a launcher is used.
Checking Drush and Site Status
- Show Drush version
vendor/bin/drush --version
- Check Drupal site status
vendor/bin/drush status
- Show PHP, database, and bootstrap information
vendor/bin/drush st
Cache Management
- Rebuild all caches
vendor/bin/drush cr
- Clear a specific cache bin
vendor/bin/drush cache:clear <bin>
Module Management
- List all modules
vendor/bin/drush pm:list
- Enable a module
vendor/bin/drush en <module>
- Disable a module
vendor/bin/drush pm:uninstall <module>
- Install a module via Composer (required before enabling)
composer require drupal/<module>
Theme Management
- List themes
vendor/bin/drush theme:list
- Enable a theme
vendor/bin/drush theme:enable <theme>
- Set default theme
vendor/bin/drush config-set system.theme default <theme>
Database and Updates
- Run database updates
vendor/bin/drush updb
- Import configuration
vendor/bin/drush cim
- Export configuration
vendor/bin/drush cex
User Management
- List users
vendor/bin/drush user:list
- Create a user
vendor/bin/drush user:create <name> --mail=<email> --password=<pass>
- Add a role to a user
vendor/bin/drush user:role:add <role> <user>
Maintenance and Utilities
- Put site into maintenance mode
vendor/bin/drush sset system.maintenance_mode 1
- Disable maintenance mode
vendor/bin/drush sset system.maintenance_mode 0
- Run cron
vendor/bin/drush cron
- Show watchdog log messages
vendor/bin/drush ws
File and System Information
- Show file system status
vendor/bin/drush core:status
- Run system requirements check
vendor/bin/drush core:requirements
Notes
- All commands assume Drush is executed from the project root.
- Replace <module>, <theme>, <role>, and <user> with actual names.
- Composer is required for downloading modules; Drush only enables or disables them.
| Command | Description |
|---|---|
vendor/bin/drush --version
|
Show the installed Drush version. |
vendor/bin/drush status
|
Display Drupal site status, including bootstrap, database, and paths. |
vendor/bin/drush st
|
Short form of status. |
vendor/bin/drush cr
|
Rebuild all caches. |
vendor/bin/drush cache:clear <bin>
|
Clear a specific cache bin. |
vendor/bin/drush pm:list
|
List all modules and their status. |
vendor/bin/drush en <module>
|
Enable a module. |
vendor/bin/drush pm:uninstall <module>
|
Uninstall a module. |
composer require drupal/<module>
|
Download a module via Composer (required before enabling). |
vendor/bin/drush theme:list
|
List all themes. |
vendor/bin/drush theme:enable <theme>
|
Enable a theme. |
vendor/bin/drush config-set system.theme default <theme>
|
Set the default theme. |
vendor/bin/drush updb
|
Run database updates. |
vendor/bin/drush cim
|
Import configuration. |
vendor/bin/drush cex
|
Export configuration. |
vendor/bin/drush user:list
|
List all users. |
vendor/bin/drush user:create <name> --mail=<email> --password=<pass>
|
Create a new user. |
vendor/bin/drush user:role:add <role> <user>
|
Add a role to a user. |
vendor/bin/drush sset system.maintenance_mode 1
|
Enable maintenance mode. |
vendor/bin/drush sset system.maintenance_mode 0
|
Disable maintenance mode. |
vendor/bin/drush cron
|
Run cron. |
vendor/bin/drush ws
|
Show watchdog log messages. |
vendor
|