Drush – The command line tool for Drupal development

In Drupal development, we spend quite a lot of time on module management.

  1. Browser: Go to the module page
  2. Browser: Copy the download link
  3. Shell: Go to the sites/all/modules directory
  4. Shell: Download the module using the wget command with the copied link
  5. Shell: Extract the module by the tar command
  6. Shell: Remove the extracted archive
  7. Browser: Login to the Drupal instance and go to the module page
  8. Browser: Enable the module

 

A typical Drupal website requires about twenty modules. That means you need to repeat the above tedious steps for twenty times. Besides, you have to move your focus between the browser and the shell prompt.

If you are a command line enthusiast, Drush is the tool you are looking for and all the steps can be done through the shell console.

1. Go to your home folder.

  • cd /home/<username>

 

2. Go to the Drush project page and copy the latest download link. Download it to your home folder.

 

3. Extract it.

  • tar zxf drush-7.x-5.8.tar.gz

 

4. Edit your own .bashrc and append the following line on it.
/home/<username>/.bashrc

export PATH="$PATH:/home/<username>/drush"

 

5. Update the change by passing it to the TCL Interpreter.

  • source .bashrc

 

7. Check if it works.

  • drush status

drush-1
 

8. Go to the Drupal instance webroot and try download a module. For example, admin_menu

  • drush dl admin_menu

drush-2
 

9. Enable the module you need.

  • drush en admin_menu_toolbar

drush-3
 

10. Disable the module you don’t need anymore.

  • drush dis toolbar

drush-4
 

Done =)

Reference:

Advertisement

One thought on “Drush – The command line tool for Drupal development”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.