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.



Type the name of a command, module, action or category
Suggestions to try:
  • maintenance
  • dev
  • config
  • cache
  • export
  • settings
  • cache:clear - Clear a specific cache, or all Drupal caches.

    drush cc drush cache:clear drush cc bin drush cc render drush cc bin entity,bootstrap
  • cache:rebuild - Rebuild a Drupal 8 site.

    drush cr drush cache:rebuild
  • updatedb:status - List any pending database updates.

    drush updatedb:status drush updbst
  • version - Show Drush version.

    drush version
  • updatedb - Apply any database updates required.

    drush updatedb drush updb
  • directory - Return the filesystem path for modules/themes and other key folders.

    drush drupal:directory drush dd drush dd %module_name% drush dd files
  • runserver - Runs PHP's built-in http server for development.

    drush rs 8080 drush rs %IP%:80 drush rs [::1]:80 drush rs --dns localhost:8888/user drush rs / drush rs --default-server=127.0.0.1:8080/
  • list - List available commands.

    drush list drush list --filter=dev
  • cache:get - Fetch a cached object and display it.

    drush cache:get %cid% %cache.bin.storage% drush cache:get hook_info bootstrap drush cache:get module_implements bootstrap drush cache:get block.block.bootstrap_content config drush 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:status drush config:status --state=Any
  • config:delete - Delete a configuration key, or a whole object.

    drush config:delete %name% drush config:delete system.site drush 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.large drush config:edit drush --bg config-edit image.style.large
  • config:export - Export Drupal configuration to a directory.

    drush config:export sudo drush config:export --destination /tmp
  • config:get - Display a config value, or a whole configuration object.

    drush config:get system.site drush config:get system.site page.front drush 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 @stage drush 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:cron drush cron
  • core:config - Edit drushrc, etc, site alias, and Drupal settings.php files.

    drush core:edit drush core:config etc drush 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:requirements drush core:requirements --severity=1 drush status-report drush rq
  • core:status - An overview of the environment - Drush and Drupal.

    drush core-status drush status drush st
  • core:topic - Read detailed documentation on a given topic.

    drush topic drush core-topic
  • core:rsync - Rsync Drupal code or files to/from another server using ssh. @dev,@stage - need to be defined.

    drush rsync drush rsync @dev @stage drush rsync ./ @stage:%files/img
  • entity:delete - Delete content entities. Node, User, ...

    drush entity:delete node --bundle=page drush entity:delete node 22,24 drush 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:flush drush image:flush thumbnail,large drush image:flush --all
  • locale:check - Checks for available translation updates.

    drush locale:check drush locale-check
  • locale:import - Imports to a gettext translation file.

    drush locale-import %langcode% %file% drush locale-import nl drupal.po drush 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-delete drush pathauto:aliases-delete canonical_entities:node drush pathauto:aliases-delete all drush pathauto:aliases-delete all --purge
  • pathauto:aliases-generate - (Re)generate URL aliases.

    drush pag drush pathauto:aliases-generate drush pathauto:aliases-generate all all drush pathauto:aliases-generate create canonical_entities:node
  • php:cli - Open an interactive shell on a Drupal site.

    drush php:cli drush php drush 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.php drush scr script.php --script-path=/path/to/scripts
  • pm:enable - Enable one or more modules. (Module need to be downloaded first

    drush en ctools drush pm-enable devel,ctools
  • pm:uninstall - Uninstall one or more modules and their dependent modules.

    drush pmu ctools drush pm-uninstall devel,ctools
  • pm:list - Show a list of available extensions (modules and themes).

    drush pml drush pml --type theme drush pml --type module drush pml --type module --status Enabled
  • pm:security - Check Drupal Composer packages for pending security updates.

    drush pm:security drush pm:security --format csv