What Is Drush?
Drush (a portmanteau of Drupal Shell) is a Linux application that allows you to perform many common tasks (such as installing and updating modules, clearing caches, viewing and deleting watchdog messages, etc.) from the command line. It's a handy tool, especially if you maintain a lot of Drupal sites.
Using Drush
As of November, 2009, Drush is installed on the corn timeshare machines. SSH into corn (see logging into shared UNIX workstations for more info) and start using drush by typing:
drush help
at the command prompt and hit ENTER. This will give you a list of available commands and options:
Example 1: Downloading, Enabling, and Disabling Modules
First, you need to change your current working directory to your drupal modules directory. Type:
cd /afs/ir/group/yourgroup/cgi-bin/drupal/sites/all/modules
at the command prompt and hit ENTER.
Next, type:
at the command prompt and hit ENTER.. This command will download the
Administration Menu module.
Next, type:
drush -y en admin_menu
at the command prompt and hit ENTER. This will enable the Administration Menu module. (You'll still need to use the web interface to configure permissions for the module, and to configure any of the module's settings.)
To disable the module, type:
drush -y dis admin_menu
at the command prompt and hit ENTER. This will disable the Administration Menu module.
Example 2: Updating Modules
Type:
drush -sy update
at the command prompt and hit ENTER.. This command will
simulate updating all modules to the recommended versions (the -s option), answering "yes" to all prompts (the -y option), and run update.php. Unless you specify a specific version of a module, Drush will download only stable releases of modules (i.e., not dev or beta versions). Drush also will back up your current modules in a
backup directory at the root of your drupal install.
Finally, type:
drush -y up
at the command prompt and hit ENTER.. This command will actually update all the modules, back up the current code, and run update.php. It also will report any errors that it encounters.
More Fun with Drush
drush cc
will clear your caches
drush pml modules
generates a report of which modules are installed, enabled, and disabled
drush cron
runs Drupal's cron scripts
(Special thanks to Jon Robertson and Tim Skirvin of ITS for helping with the configuration and installation of Drush on Leland!)