Chapter 1. Installation and Basic Usage

Drush is a command-line shell and scripting interface for Drupal. It provides a set of commands which act as shortcuts to perform common tasks with Drupal sites. The purpose of this book is to explain Drush capabilities through practical examples. This chapter starts by showing some advanced examples and then focuses on installation, usage, and some basic concepts. The following chapters cover the command toolkit, customization, and extension.

These are the major things we will be covering in this chapter:

  • How to install Drush in different operating systems
  • The general syntax of a Drush command
  • How to tell Drush which site we want it to work with

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. Open the login form of that website in a web browser.
  2. Enter the username and password of a user with administrative rights.
  3. Navigate through Administration | Configuration | Performance and hit the button labeled as Clear cache.
  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!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.31.209