What is Drush?
Drush is a command-line shell and scripting interface specifically designed for Drupal.
How to Install Drush
There are two ways to install Drush, depending on how you installed Drupal:
With Composer: If you installed Drupal using Composer with the drupal/recommended-project package, Drush is likely already included. You can check your composer.json file to verify.
composer create-project drupal/recommended-project my_site_nameWithout Composer: If you didn't use Composer, you can install Drush manually by running the following command:
composer require drush/drushHow to execution
Call Drush via vendor/bin/drush <command>
Example: Drush use cases
Enable Modules:
vendor/bin/drush en module-name -yUninstall Modules:
vendor/bin/drush pmu module-name -yClearing the Cache:
vendor/bin/drush cache:rebuildvendor/bin/drush crRun all cron hooks in all active modules:
vendor/bin/drush maint:status && drush core:cronUse maint:status for run cron when Drupal is not in maintenance mode.
Flush all derived images for a given style:
vendor/bin/drush image:flushSet site maintenance mode:
vendor/bin/drush maint:set 11 = Put site into Maintenance mode.
0 = Remove site from Maintenance mode.
Apply any database updates required (as with running update.php):
vendor/bin/drush updatedb:statusvendor/bin/drush updatedbEnable Theme:
vendor/bin/drush theme:enable theme-name -yFor more information please visit: https://www.drush.org