Drupal Drush snippets tool kit.
List of useful drush commands for day to day maintenance or development tasks, from Drupal core and other modules. With examples of usage.
-
cache:clear - Clear a specific cache, or all Drupal caches.
drush ccdrush cache:cleardrush cc bindrush cc renderdrush cc bin entity,bootstrap -
cache:rebuild - Rebuild a Drupal 8 site.
drush crdrush cache:rebuild -
updatedb:status - List any pending database updates.
drush updatedb:statusdrush updbst -
version - Show Drush version.
drush version -
updatedb - Apply any database updates required.
drush updatedbdrush updb -
directory - Return the filesystem path for modules/themes and other key folders.
drush drupal:directorydrush dddrush dd %module_name%drush dd files -
runserver - Runs PHP's built-in http server for development.
drush rs 8080drush rs %IP%:80drush rs [::1]:80drush rs --dns localhost:8888/userdrush rs /drush rs --default-server=127.0.0.1:8080/ -
list - List available commands.
drush listdrush list --filter=dev -
cache:get - Fetch a cached object and display it.
drush cache:get %cid% %cache.bin.storage%drush cache:get hook_info bootstrapdrush cache:get module_implements bootstrapdrush cache:get block.block.bootstrap_content configdrush cache:get route:[language]=en:/node/2: data -
cache:set - Cache an object expressed in JSON or var_export() format.
drush cache:set %cid% %bin% %expire% %tags% -
config:status - Display status of configuration (differences between the filesystem configuration and database configuration).
drush config:statusdrush config:status --state=Any -
config:delete - Delete a configuration key, or a whole object.
drush config:delete %name%drush config:delete system.sitedrush config:delete system.site page.front -
config:edit - Open a config file in a text editor. Edits are imported after closing editor.
drush config:edit image.style.largedrush config:editdrush --bg config-edit image.style.large -
config:export - Export Drupal configuration to a directory.
drush config:exportsudo drush config:export --destination /tmp -
config:get - Display a config value, or a whole configuration object.
drush config:get system.sitedrush config:get system.site page.frontdrush config:get system.site mail -
config:set - Set config value directly. Does not perform a config import.
drush config:set system.site page.front '/frontpage'drush config:set system.site mail 'new@email.com' -
config:pull - Export and transfer config from one environment to another.
drush config:pull @prod @stagedrush config:pull @prod @self --label=vcs -
config:import - Import config from a config directory.
drush config:import -
core:cron - Run all cron hooks in all active modules for specified site.
drush core:crondrush cron -
core:config - Edit drushrc, etc, site alias, and Drupal settings.php files.
drush core:editdrush core:config etcdrush core:config sett -
core:init - Enrich the bash startup file with bash aliases and a smart command prompt.
drush core:init -
core:requirements - Information about things that may be wrong in your Drupal installation.
drush core:requirementsdrush core:requirements --severity=1drush status-reportdrush rq -
core:status - An overview of the environment - Drush and Drupal.
drush core-statusdrush statusdrush st -
core:topic - Read detailed documentation on a given topic.
drush topicdrush core-topic -
core:rsync - Rsync Drupal code or files to/from another server using ssh. @dev,@stage - need to be defined.
drush rsyncdrush rsync @dev @stagedrush rsync ./ @stage:%files/img -
entity:delete - Delete content entities. Node, User, ...
drush entity:delete node --bundle=pagedrush entity:delete node 22,24drush entity:delete user -
entity:updates - Apply pending entity schema updates.
drush entity-updates -
image:derive - Create an image derivative.
drush image:derive thumbnail /tmp/test.png -
image:flush - Flush all derived images for a given style.
drush image:flushdrush image:flush thumbnail,largedrush image:flush --all -
locale:check - Checks for available translation updates.
drush locale:checkdrush locale-check -
locale:import - Imports to a gettext translation file.
drush locale-import %langcode% %file%drush locale-import nl drupal.podrush locale-import nl translation.po --type=custom --override=all -
locale:update - Imports the available translation updates.
drush locale-update -
pathauto:aliases-delete - Delete URL aliases.
drush pathauto:aliases-deletedrush pathauto:aliases-delete canonical_entities:nodedrush pathauto:aliases-delete alldrush pathauto:aliases-delete all --purge -
pathauto:aliases-generate - (Re)generate URL aliases.
drush pagdrush pathauto:aliases-generatedrush pathauto:aliases-generate all alldrush pathauto:aliases-generate create canonical_entities:node -
php:cli - Open an interactive shell on a Drupal site.
drush php:clidrush phpdrush core-cli -
php:eval - Evaluate arbitrary php code after bootstrapping Drupal (if available).
drush php:eval 'echo drupal_get_user_timezone();'drush php:eval 'drupal_flush_all_caches();' -
php:script - Run php a script after a full Drupal bootstrap.
drush scr script.phpdrush scr script.php --script-path=/path/to/scripts -
pm:enable - Enable one or more modules. (Module need to be downloaded first
drush en ctoolsdrush pm-enable devel,ctools -
pm:uninstall - Uninstall one or more modules and their dependent modules.
drush pmu ctoolsdrush pm-uninstall devel,ctools -
pm:list - Show a list of available extensions (modules and themes).
drush pmldrush pml --type themedrush pml --type moduledrush pml --type module --status Enabled -
pm:security - Check Drupal Composer packages for pending security updates.
drush pm:securitydrush pm:security --format csv