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)

Optimizing the terminal for Drush


The drush-cli command adds a few environment settings to our terminal session so we can issue Drush commands even faster. Among other things, it adds the following features after being executed:

  • Execute all Drush commands against a specific site.

  • Change directory to the root, modules, or files directories of a site.

  • List files within a directory of a site.

  • Execute commands without having to type drush at the start.

We will first enter on the Drush CLI and test a few commands. Then we will explain how to add Drush CLI configuration to our default terminal profile.

Starting a Drush CLI is as easy as executing the following command:

$ drush core-cli
Entering the drush cli. Use CONTROL-D to exit.
Type 'help' for help.
drush>

Now we will load one of our site aliases and execute a few commands such as changing directory, listing files and clearing the cache:

drush> use @drupal.local
@drupal.local>
@drupal.local> cd %files
cd /home/juampy/projects/drupal...