The yelling and screaming in the background would be my absolute reluctance to move forward into a Drush environment. I had all fingers and toes firmly planted – committed that Drush had nothing to offer me.  Boy, was I wrong – let me explain.

Drush, the Drupal shellDrush turns out to be a wonderful ‘shell interface’ that lets you manage your Drupal sites right from your computer or server using simple text commands,  ultimately bypassing  the guide-style interface that requires an abundance of clicking around with a mouse. This kind of work is not only slow, but very tedious. (Check out our Drupal Dictionary for help with some terms in this post!)

However, Drush changes all that. One or two lines of text in your terminal can provide a amazing amount of opportunities that I am just beginning to understand.

Installing Drush

Drush is not a typical project that you download and enable on one particular site. It provides a command line interface that actually has to be installed on your computer or server.  

The Drupal project page directs you here, where you can get the latest Drush download. In addition, I found this link, which I frequently check to ensure that I have the correct information that points me to the proper tutorials.

There are multitudes of tutorials available online that provide simple step-by-step guidance for installing Drush. These sites are far more capable than I to provide adequate instruction and address your particular configuration.

I installed Drush on my computer and on my hosting server to facilitate a local development environment. Each installation was quick and relatively painless, but well worth the effort of researching my particular configuration and understanding the process.

Note: The following commands need to be performed from within the directory of your Drupal installation. It doesn't really matter where you are located within the path, as long as you are somewhere within the root folder.

cd /var/www/[drupal_folder_name]

General Commands

drush status

This command will give you a general overview of your Drupal site:  Version Number, URI, database location, file paths, default theme etc. It is a good way to ensure that Drush is working as it should, especially when you get a little confused down the road. It helped me to reestablish my focus and confirm all was good.

drush cc or drush cc all (which flushes all your caches)

If you have developed anything in Drupal, you have to become one with flushing the cache. You have to do it often, and this is a fast option to do so.  

A Project Installation

To install Views, you can run the following command:

drush dl views

This command will download Views and will immediately notice and identify any dependencies that Views requires, in this case CTools. When prompted and returning a “YES”,  you confirm that you want to download and enable this module and all others modules that are required.

Modules are automatically placed in the sites/all/modules folder.  

Enable Command

drush en views

Disable Command

drush dis views

But look what you can do ….

drush -y dl en views ctools token fences entity features

This one command line will download and enable all these modules in about 30 seconds flat. The -y bonus sends the affirmation of Yes to downland and enable each module. There, you are not prompted for each module. Thanks for that.

Conclusion

I hope that you can see from the above how Drush can make your life easier. I am just scratching the surface and I hope to perfect this skill as I practice with this new system.