Drush - Getting started, Tutorial and Videos

Most of the time we manage our drupal sites using cpanel and are used to this shared hosting environment , we usually run backups through phpmyadmin, upload and install modules with FTP and the modules pane, etc. I always thought there must be a faster way to do this. And yes there is, the answer is drush.

Its slighlt more techie than GUI based work , but it can save you substantial amount of time and its worth the small initial effort put in learning. Drush has console scripts to do damn near everything with next to no effort (backup a site, configure for local/staging/production, add files to configuration management tool, update a D/B). It's pretty awesome to be able to archive an entire site + DB into your configuration management tool, pull is down to staging, load the new DB and config Drupal for staging in about a minute from the same window. Just to give you a simple sample.

To install and enable view. Here are simple commands

First download it:

drush dl views

Then enable it:

drush en views

No FTP at all! No browsing through 30 modules on the modules page to enable the new one!. Per website it can save upto an hour. Downloading, enabling the latest versions of CCK, Views, Field Collection, Lightbox, Google Analytics, Captcha, File Attach, Image Attach, Path Auto, Tokens.... can all be done in single command. It also does cache clearing .

Drush is 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.

Q – Can I use drush on my cpanel A – Only if you have shell access. Otherwise you can always use drush on your development environment on windows, mac or ubuntu.

First Install Drush 5 on your windows ( Drush 4 is not compatible with Windows) Download Drush 5.7 Windows Installer. In case you want more details about installation you can refer to Installation Guide After installation you can get started with basic commands. Watch the video below.A whole website is dedicated to drush documentation and commands. Visit http://drush.ws , but if you don’t have time to go through the same, I advise get started using this cheat sheet http://drupal.org/files/drush-cheat-sheet.pdf

Okay the best is yet to come. Now that you know about Drush and all the great things it can do you wonder if there was a way to make a drush script or drush makefile which will club all your commands in one and when you make a new drupal website you should be able to download, install and enable modules, themes and libraries in one go.

Yes you can do this and save hours. Refer this website http://drushmake.me/ This is an online free tool to generate makefile, which is nothing but a macro for installing Drupal. It contains a list of files that can be fetched using the power of drush, the command line tool for administering Drupal. Using this generator you can specify different Drupal core distributions, modules, themes, and external libraries like jQuery or WYSIWYG editors. The end result is a small text file containing the DNA for a specific Drupal setup

Related articles