What is Drush?

Drush is a command line tool for Drupal manipulation. The main common tasks can all be performed by typing only one line of code.
This tool can make your job faster than you think.

Why should you be interested in using Drush?

For short: it can speed up your work.

Lets see for example a simple task to enable the views module
Step 1. Go to the drupal.org site and locate the module
Step 2. Download and Extract the zip.
Step 3. Copy to the sites/all/modules folder
Step 4. Go to Administration >> Modules page in your Drupal site (admin/modules)
Step 5. Find the module in the list and try to enable.
But you will see that you can't enable Views UI module since you have to download the CTools module first.
And than you start again from Step 1 again.

This just gets ever more worst if you have 3, 4 or more dependencies.

Now if you would like to perform the same tasks using drush it would be the following:

kzoltan@localhost:/var/www/localdrupal$ drush dl views
Project views (7.x-3.7) downloaded to /var/www/localdrupal/sites/all/modules/contrib/views.Project views contains 2 modules: views_ui, views.
kzoltan@localhost:/var/www/localdrupal$ drush en views
The following extensions will be enabled: views_ui, views
Do you really want to continue? (y/n): y
views_ui was enabled successfully.
views was enabled successfully.

Most common drush commands / tasks:

  • view all command possibilities -> drush
  • get help about a command -> drush --help
  • check site setup -> drush status
  • download module -> drush dl
  • enable module -> drush en
  • disable module -> drush dis
  • project module list (lists modules and themes) -> drush pml
  • project module info (information about a particular drupal project) -> drush pmi
  • clear all cache -> drush cc all

And many more ... See http://www.drush.org for a complete list.

How to get drush working for you?

Goto: https://drupal.org/project/drush

Remember it's not a usual Drupal module so the installation is a bit different.
Even though you can now use Drush in a Windows environment (http://www.drush.org/drush_windows_installer) I would suggest to use Linux, for Drupal development.
If you want to stick to Windows than the best solution is to use Linux in a VirtualBox.

Installing Drush in Linux

Stéphane Corlosquet has a great blog post about this
http://openspring.net/tip/how-to-install-drush-serverwide-in-less-than-o...

after doing the steps described in that blog post don't forget to run
drush self-update

Another way would be to do it as described on the D.org page

pear channel-discover pear.drush.org
pear install drush/drush

Summary of useful resources
Below you will find a collection / summary of useful resources if I have convinced you to start using Drush

https://drupal.org/project/drush
http://www.drush.org
http://www.slideshare.net/carsonblack/intro-to-drush-8317619

Another interesting topic are drush make files but more about this later. Stay tuned!

Tags: 
drush
linux
command line