Share
Have you ever built a website in Drupal, then a few months later needed to update some modules, or even worse, need to update the Drupal core?
Before Drush existed, you would need to check the available updates, download each one, and manually install them. If those module updated changed the database, you would also have to run the update.php script.
With Drush, you can do all of the above using one simple command:
$ drush up
How amazing is that!?
So what is this magical Drush utility you say? Drush (rhymes with flush) is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt. http://drupal.org/project/drush
What can Drush do for me you ask? Well, for starters you can setup and launch a new Drupal site right from the command line. Here are some of the most important things you can do
Updating Drupal Sites
If you need to update the core, and all modules simply run the following command. Drush also makes a local backup before it updates, in case updating something breaks your site.
$ drush up
Sometimes you want to update all the modules, without updating core.
$ drush up--no-core
If you know which modules to update, you can specify the individual module on the command line
$ drush up views
Downloading Modules
The command drush up will download updates for existing modules, but what if you need to download a module you dont have.
$ drush dl views
Drush also allows you to specify which version of a module to use
$ drush dl views --select
Choose one of the available releases for views:
[0] : Cancel
[1] : 7.x-3.7 - 2013-Apr-09 - Supported, Recommended
[2] : 7.x-3.x-dev - 2013-Mar-29 - Development
[3] : 7.x-3.6 - 2013-Mar-20 - Security
Clear the Cache
Ever need to clear the cache? The admin menu module makes it easy, but command line is even faster. Drush allows you to clear the cache, and optionally select which items to clear.
$ drush cc
Enter a number to choose which cache to clear.
[0] : Cancel
[1] : all
[2] : drush
[3] : theme-registry
[4] : menu
[5] : css-js
[6] : block
[7] : module-list
[8] : theme-list
[9] : registry
Running the Update Script
Instead of going to /update.php on your site and walking through the script, you can run the update script using Drush.
$ drush updb
Running Cron
If your modules need you to run cron, you can run it using Drush.
$ drush cron
Cron run successful.
Above are just a few of the most popular commands. If you want to get really technical, you can also write scripts and execute them with Drush. I recently read Drush User's Guide which has all of the above commands and more.
Using Drush has saved us countless hours keeping our Drupal websites up to date.