About Drush

Drush is an awesome command line interface for Drupal

If you have multiple sites (and even in cases of single site use) and you are not using Drush, you are missing out

Installing Drush:

  • First we need to download drush through pecl:
pear channel-discover pear.drush.org
pear install drush/drush
now, you can check drush is installed by typing "drush from command line"
  • In centos, default php settings are too restrictive so we need to make a drush.ini that allowes exec:
_ mkdir /etc/drush
_ cp /usr/share/pear/drush/examples/example.drush.ini /etc/drush/drush.ini
when done, uncomment the disable_function="" line

Useful commands

et voilĂ , you are ready to boost your productivity using drupal by an order of magnitude. Here are some of the commands I use
  • #drush self-update - check for drush updates 
  • #drush updatedb - applies any db update like update.php
  • #drush core-status - info about current site like db connections etc (if in directory) or default site if none specified #drush
  • pm-updatecode - update all core modules
  • #drush cache-clear - clear the cache, optional what to clear (all,drush,theme-registry,menu,css-js,block,module-list,theme-list,registry)
  • Setting useful variables:
    • drush vset site_offline [state] - put site in maintainance mode (1) or back online (0)
    • drush vset theme garland - good way to reset theme if current one has problems (you obviously can set another one instead of garland)
    • drush vset clean url 1 - enable clean urls
  • drush dl [module name] -download a module
  • drush en [module name] -enable a module (with optional -y to auto confirm)
  • drush pm-update - check which modules need updating
  • drush up [module_name] - update a module