5 Reasons You'll Love Using Drush With Drupal

The command line: most programmers love its power; most web users fear its (alleged) complexities. But for those willing to dive in, the reward is great. Using Drush on Drupal can save you several hours a week just on website maintenance tasks alone. Here is a short list to get you started:

1. Download and Install Multiple Modules Simultaneously

Installing modules on drupal is easy. You just have to

  1. Go to Drupal.org
  2. Search for the module's page
  3. Download the module's zip file
  4. Unzip
  5. Move to sites/all/modules
  6. Open up your web browser
  7. Go to the modules page
  8. Click off the checkbox for the module
  9. Save your changes

That's 9 steps per module. And if you have 30+ modules to install, that can take up to several hours if you're not nimble with your keyboard and mouse. With drush, you can do it in 2 lines:

Download command:

drush dl addressfield admin_menu advanced_help amazon_s3 awssdk backup_migrate boxes calendar ckeditor ckeditor_swf coder commerce commerce_features commerce_feeds commerce_file commerce_product_key contemplate context ctools custom date devel devel_themer drupalforfirebug echo email emogrifier entity facebook_pull fb_social features feeds feeds_querypath_parser feeds_tamper feeds_xpathparser field_group filter_transliteration flowplayer getid3 globalredirect gmap google_analytics grammar_parser hacked html5_tools htmlmail i18n imce include job_scheduler jplayer jquery_update kfs libraries link location mailchimp mailmime mailsystem md5check media media_amazon media_browser_plus media_flickr media_youtube mediaelement menu_block migrate mimemail nice_menus omega_tools panels pathauto pathologic plupload quicktabs references relation rolereference rules search_api service_links services sexybookmarks skinr styles token transliteration viewfield views views_accordion views_bulk_operations views_pdf workbench workbench_access workbench_files workbench_media workbench_moderation wysiwyg xmlsitemap

Install command:

drush install addressfield admin_menu advanced_help amazon_s3 awssdk backup_migrate boxes calendar ckeditor ckeditor_swf coder commerce commerce_features commerce_feeds commerce_file commerce_product_key contemplate context ctools custom date devel devel_themer drupalforfirebug echo email emogrifier entity facebook_pull fb_social features feeds feeds_querypath_parser feeds_tamper feeds_xpathparser field_group filter_transliteration flowplayer getid3 globalredirect gmap google_analytics grammar_parser hacked html5_tools htmlmail i18n imce include job_scheduler jplayer jquery_update kfs libraries link location mailchimp mailmime mailsystem md5check media media_amazon media_browser_plus media_flickr media_youtube mediaelement menu_block migrate mimemail nice_menus omega_tools panels pathauto pathologic plupload quicktabs references relation rolereference rules search_api service_links services sexybookmarks skinr styles token transliteration viewfield views views_accordion views_bulk_operations views_pdf workbench workbench_access workbench_files workbench_media workbench_moderation wysiwyg xmlsitemap

The above commands may look ominous, but it's just drush 'command' and then a list of modules. Drush takes care of the rest.

2. Automatic Module Updates

Updating modules can be a pain. You have to check for avaialble updates, then repeat the process above in #1. Or, you can run: "drush up." This will tell drush to:

  1. check which modules are installed on the current site
  2. check to see if there are updates available
  3. notify you what modules are out of date
  4. ask you if you'd like to proceed
  5. download all the modules and place them into the proper location
  6. run update.php for you

This function alone saves me 2 hours a week.

3. Quickly Clear All Caching

You made a change to your site, but it's just not showing up! It might be a cache thing. Views, blocks, css, javascript: many components of Drupal are cached for performance. But this can make development difficult because you need to keep navigating to the admin areas to clear the system cache and flush the changes.

OR, you can run "drush cc all" to clear all the caching systems at the same time. This is super convenient.

4. Easy Backups

If you're developing on the bleeding edge (Drupal 7 with only dev versions of all of your modules, possibly with patches), you've probably experienced a corrupt database that simply could not be recovered. No fun. The easiest way to protect yourself is quick backups. But just like clearing your cache, you don't want to have to leave the page you're on and come back. Simply run "drush bam-backup" and a database copy will be generated and downloaded into the manual backups directory. For bleeding edge projects, I use this command compulsively because it's saved me so many times.

5. Control multiple sites

If you run more than one site (or a dozen sites), it can be tedious to manually update the modules at the same time. But drush allows you to create scripts and installation profiles, so you can quickly run the same commands on all of them. "drush @site1 up; drush @site2 up; drush @site3 up" would run the module update commands on 3 different sites, one right after another, without having to navigate your terminal to each site in between. This gives you a command center feel and allows you to connect to each site from one location, saving lots of time and focus for the bigger tasks at hand.

 

I hope you enjoyed this. If you have any questions or things to add, please leave a comment below. Are you using drush? If not, what's holding you back?

PS. If you're already a fan, you can buy the I heart drush here.

Tags: Drupal, Drupal Planet, drush
comments powered by Disqus