Here are a few of my favourite things (Drush commands)

February 17, 2012

In case you didn’t already know, Drush is great. It can massively speed up the Drupal development process. Here are some of the commands I use again and again, so I’ve got them all in one place for reference.

Clear the CSS & JS aggregation cache

drush cc css+js

Clear all caches

drush cc all

Turn off CSS cache

drush vset preprocess_css 0 --y

Turn off JS cache

drush vset preprocess_js 0 --yes

Download a module from drupal.org

drush dl module_name (the name.module file name without the .module part)

Enable a module

drush en module_name -y

Disable a module

drush dis module_name -y

Uninstall a module

drush pm-uninstall module_name

List all enabled modules

drush pm-list --status=enabled --type=module
drush pm-list --status=enabled --type=module --no-core

Run an install or update hook manually

Drupal 7

drush ev "module_load_install('mymodule');mymodule_update_1234();"

Drupal 10

drush ev "\Drupal::moduleHandler()->loadInclude('mymodule', 'install');mymodule_update_1234();"

Check the current schema version of a module

drush ev "print_r(\Drupal::service('update.update_hook_registry')->getInstalledVersion('mymodule'))"

Clear feature cache

drush fl

Revert a Feature

drush fr feature_name

Update a Feature

drush fu feature_name

Let anonymous users view devel info

drush role-add-perm 'anonymous user' 'access devel information'

In Drupal 6, this requires Permissions API module: drush perm-grant ‘anonymous user’ ‘access devel information’ This seems to have been removed and replaced with a different syntax:

drush perm-grant --all-roles --permissions='access devel information'

In Drupal 7, this is in core

Check the watchdog logs

drush watchdog-show --tail

View full details of a specific log entry

drush ws 1234

Delete/clear watchdog log

drush wd-del all