Drush
Drupal Shell do doo doo do. The Drupal Shell do doo doo do. The Drupal Shell doo doo do doo doo do, do do do do do do do do do do MORE DRUPAL!
Ok, aside from that cool song I just wrote, Drush is offically known as the Drupal shell. It allows you to control many aspects of your Drupal website through command line. Drush is simply a PHP file that allows command line access to many of Drupal's administration features. Drush only works on Linux based operating systems, so Windows users will have to set it up in Cygwin. Don't expect me to put any tutorials up on that any time soon, but here is some helpful information for those using Debian based Linux distributions like Ubuntu or Lenny who want to run Drush to administer their Drupal website.
This guide assumes that you have already installed you LAMP stack and have SSH access or command line access to your server.
Installing Drush
sudo apt-get install php5-cli or php4-cli.
set your php5-cli PHP.ini memory limit. In most cases you will run out of the 32MB fairly quickly. Change this to a higher value such as 64MB on smaller servers, or possibly 128MB if you have a larger server.
wget latest stable release from http://drupal.org/projects/drush to a folder on your server. I usually go with an apps folder inside my home directory. Extract the tarball and you should be left with a folder called drush in the folder you chose. For security purposes, we will hide this folder by renaming it to .drush. To do this type mv drush .drush in your command line.
Next you have to create an alias in your .bashrc to drush='/path/to/.drush/drush'. This makes your shell able to call the drush PHP file by just typing drush and then your command. Otherwise, you will have to type the full path for each command, and who wants to do that?
Test to see if your Drush is installed properly by typing drush in the command line. You should recieve a list of Drush commands on your screen. If so, you have installed Drush properly and can move on to how to use Drush below.
Using Drush - How to Use Drush
One of the coolest features of Drush is that all of the commands are very simple. In order to download a project to your server, all you have to type is drush dl projectname, where projectname is the project you are looking to download. You can also include a string of projects as one command.
Drush dl examples:
- drush dl cck
- drush dl cck views admin_menu
Once you have your projects downloaded, you can also enable them through the Drush command line. All you have to type is drush en projectname, where projectname is the project you are looking to enable. In some cases, modules are made up of several smaller modules, and you have to enable each of these modules by name. You can also enable mulitple projects at a time by combining them into the command.
Drush en examples:
- drush en admin_menu
- drush en admin_menu views
There are many other advanced tasks you can perform with Drush that we will cover later in this article when we have used them more. For now, this should give you some excellent info to get started with Drush. Believe me, you will not turn back to downloading, extracting, and uploading Drupal modules ever again. You might not even want to travel back to the module administration page within the Drupal UI either.
Drush Commands
drush dl - drush download
drush en - drush enable
drush dis - drush disable
drush up - drush update
To see a full list of Drush commands check out the documentation on Drupal.org.
Drush 3 Brings in Some New Commands
Drush was already awesome, but Drush 3 opens a whole new can of whoopass on managing your Drupal site through command line. I happened to catch a sesson at Drupalcon SF 2010 about the upcoming features being release wit Drush 3 and I was thoroughly impressed. If you are a command line junky and can't get enough of what Drush had to offer before, you better get Drush 3 ASAP. Your mind will be blown with how much more power you have over your Drupal websites with Drush 3. More to come on Drush 3 soon!
Highlights
- site aliases
- provision DAMP stack
Drush Make
If you have enjoyed Drush, than you are really going to love Drush Make. Drush Make is a Drush addon that allows you to provision full Drupal installations with a single configuration file called a Drush make file. This make file allows you to setup all aspects of your Drupal site including downloading modules, themes, and setting up configuration of installed modules. Several installation profiles require Drush make to install them properly.
More Information on Drush
Here are some other great guides to using Drush. Make sure to check them out as they are by some of the developers of Drush and I am just a fanatical user of Drush.
Drupal Servers is an Arbor Drupal Development project powered by Drupal CMS, Linode, and a Ninja. Drupalservers.net is NOT an official Drupal website, and is NOT endorsed by Dries Buytaert or the Drupal Association. It's sole pupose is to foster the use of the Drupal CMS to it's visitors. This site is owned and operated by Jason Moore, an Individual Member of the Drupal Association. Drupal is a registered trademark of Dries Buytaert.
All content on this website is licensed by a Creative Commons Attribution-ShareAlike license v2.0 or greater unless otherwise noted.





Drupal Servers RSS Feed