Book Image

Drush User's Guide

By : Juan Pablo Novillo Requena
Book Image

Drush User's Guide

By: Juan Pablo Novillo Requena

Overview of this book

<p>Drush is a command line interface for Drupal. Most of the tasks for building and maintaining a website are repetitive and involve filling in forms on administration pages. The majority of these tasks can be achieved with a single Drush command, shortening the development and maintenance time of a project drastically.</p> <p><em>Drush User's Guide</em> will allow you to be more productive and efficient in building and maintaining your Drupal sites through the command line. You will learn to install Drush on different platforms, and manage and configure your Drupal site by learning how to use and create Drush commands.</p> <p>Become a Drush expert by exploring its command toolkit; customizing it to suit your needs, and extending it with contributed modules.</p> <p>The command line will allow you to download, enable and upgrade Drupal projects in seconds. Back up your files, code and data in one single file, clear the cache, interact with databases, and deploy sites to remote machines - all using simply the command line. Use Drush with your own commands or alter existing ones; and extend the toolkit with a long list of contributed modules.</p> <p><em>Drush User's Guide</em> has everything you need to extend your use of the command line to easily build and manage your Drupal sites.</p>
Table of Contents (10 chapters)

Introduction


Imagine the following scenario: you have been told to clear the cache of a website called http://somewebsite.com. Normally, this would involve the following steps:

  1. 1. Open the login form of that website in a web browser.

  2. 2. Enter the username and password of a user with administrative rights.

  3. 3. Navigate through Administration | Configuration | Performance and hit the button labeled as Clear cache.

  4. 4. Log out.

If you had Drush installed on your system, you would just need to open a terminal and execute the following command:

$ drush @somewebsite.com cache-clear all

That's it. You did not even have to provide user credentials. This little demonstration shows the potential that Drush has to simplify processes. Once you have configured Drush, you can do even cooler things such as downloading a database from a remote site to your local environment, excluding cache tables, and automatically resetting user e-mails and passwords with a command such as the following one:

$ drush sql-sync @somewebsite.com @somewebsite.local

Drush is a great tool to automate and speed up common tasks involving Drupal sites. If you have ever felt that you are doing the same thing many times, keep on reading to discover more effective ways to manage your Drupal sites!