Drush is a great tool for quickly managing routine tasks with a Drupal installation.

Drush allows you to search the drupal.org site, install Drupal, install modules, enable modules and much more.

This is going to be a tutorial aimed at Drush beginners. We'll explain how to install Drush, how to use it and how to perform some common tasks.

Some Notes Before We Start

In this tutorial, we're working with a Drupal site that is already installed. To follow this tutorial, have a Drupal site to practice on and please make sure it's one you don't mind breaking!

This tutorial explains only of several ways to use Drush. Using PEAR is another recommended method and explained on the Drush download page.

Even though Drush is listed as a module on drupal.org, it's not actually a module. It is something you will need to install on your server, not upload through Drupal's module management.

If you are familiar with using shell access and the command line for doing things like copying, moving, backing up, and installing, you'll get the hang of Drush right away. If you're not familiar with either, don't worry if the concepts in this tutorial are confusing at first. With our help and some persistence, you will get the hang of it quickly.

Yes, this tutorial is a simplification, perhaps even an over-simplification. This tutorial is called the Absolute Beginner's Guide to Drush for a reason. It's a simple introduction to a complex topic. Those expecting a great level of detail are advised to visit http://drupal.org/node/477684">this Drupal.org page.

Step 1: Setting up SSH Access

To access the server directly from your computer you will need shell (SSH) access.

What is SSH? Technically, SSH allows you to control another computer (ie, your web server) over the Internet through a command line interface (CLI). SSH is actually included by default on many Mac and Linux computers.

You will probably need to get your hosting company to enable SSH for you. Most hosting companies won't have this turned on for you.

Step 2: Install PuTTy and Connect

There are many ways that you can connect to your site using SSH, but in this example we're going to use Putty.

Download the Putty.exe file from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">from this link.

Run the PuTTy installation files.

Once you open PuTTy, it will ask you for the domain name or IP address you'll use to login. Enter that information as in the image below:

As soon as you enter your host name and click Open, you'll be taken to the command line screen. This will be a black screen with white text as in the image below.

Putty will ask you for your login username and password. This will often be identical to your FTP login or hosting account login.

You'll know that you logged in successfully if you get a message like the one below. That means that you're connected and ready to start work. If you get an Access Denied message, you'll need to try your details again.

ostraining@ostraining.com [~] #

Step 3: Download Drush

Go to http://drupal.org/project/drush.

Right-click on the download link for Drush. You want to copy the URL link. It will look like this: http://ftp.drupal.org/files/projects/drush-7.x-5.4.zip

Paste this into Putty.

wget http://ftp.drupal.org/files/projects/drush-7.x-5.4.zip

That command will run and should tell you that it connected to Drupal.org and saved Drush:

Step 4: Unzip Drush

Enter the command below and that will extract the zipped Drush file that's on your server.

unzip drush-7.x-5.4.zip

Step 5: Change Drush's Permissions

For security reasons, by default you will not have permission to use Drush. The following command will allow your system to use Drush:

chmod u+x ~/drush/drush

You can also do this via FTP. Find the file called Drush and set it's permissions to 744.

Step 6: Tell your System Where Drush is

The following command will give your system the information it needs to access Drush.

Be careful with the path. You are looking for the path to drush.php. If you have the wrong path, you'll get an Access Denied error. Try again with a new path.

export PATH="$PATH:/home/example/drush/drush:/usr/local/bin"

Step 7: Flush the Cache

The following command will reset your system so that it is ready to use Drush:

source .bashrc