Breaking News

Managing a site from the command line using Drush

Drush or drupal shell is a command-line utility to help the site building and maintenance workflows.

Available Drush Commands:

For a list of available commands  type drush help.

For a printable version use drush help --html


Other modules provide new drush commands! These become available automatically and are listed when you run drush help.


Drush autodetects the appropriate site from directory context, and read its configs from there, so if your command shell is in {drupaldir}/sites/all or anywhere under {drupaldir} then drush commands will apply to your default install. If you move your shell session into {drupaldir}/sites/mysite, then drush commands will be run in the context of the mysite multisite instance. You can always run drush status to check the currently active context.

When updating with Drush, it is not necessary to put the site in maintenance mode.

Example Commands

drush dl cck zen
Download current recommended versions of CCK module and Zen theme.
drush en content
Enable the content (cck) module.
drush vset theme_default theme_name
make theme_name theme default theme
drush --uri= status
Show status command for the multi-site.
drush pm-releases backup_migrate
Get info on all available releases for backup_migrate.module, e.g.

Project         Release      Date
backup_migrate  6.x-2.x-dev  2009-Apr-07
backup_migrate  6.x-1.2      2009-Jan-18
backup_migrate  6.x-1.0      2008-Aug-14
backup_migrate  6.x-1.x-dev  2009-Feb-19
drush -v  dl backup_migrate-6.x-1 --package-handler=git_drupalorg
Checkout via git, the current stable version of the backup_migrate module on the DRUPAL-6–1 branch into your sites/{}/modules/ directory. In this case the result is identical with just drush dl backup_migrate --package-handler=git_drupalorg as the requested version is the recommended version.
drush -v  dl backup_migrate-6.x-2.x-dev --package-handler=git_drupalorg
Checkout via git, the unstable dev version of the backup_migrate module on the DRUPAL-6–2 branch into your sites/{}/modules/ directory.
drush -v  dl backup_migrate-6.x-2.x-dev
Without specifying a --package-handler, (the default) the project bundle is retrieved via wget, and unpacked locally without the git information. This may overwrite any local changes.
drush pm-update devel
Update the devel module to the latest recommended release and apply any database updates
drush pm-update drupal
To update only Drupal core (in case of a security update)

See also: Offsite blog tutorial (with pictures) on Installing and running drush on OSX by morten

Drupalize.Me has a free video on installing Drush on all Unix systems, including OSX…Installing Drush on Unix Systems

Windows’ Drush Make command working in Drush 5.8

Being a lazy programmer, I was so excited when I discovered drush. Then, my excitement was dulled when I discovered that the drush make command did not work in Windows XP or 7. Thankfully, drush make is now working in drush 5.8.

Upgrading to dev versions of Drush using Windows

If you have a need, this article provides detailed instructions for manually upgrading to the latest development version of drush. Do worry, it’s pretty easy.

Leave a Reply

Your email address will not be published. Required fields are marked *