About Drush

Drush is a tool for Drupal that enables you to do common administrative tasks and basic scripting from the command line. For example, you can back up and restore Drupal sites, install modules, and more.

Drush is a command-line tool, so it helps if you already have some basic familiarity with the Linux command-line environment. If you have never worked in the Linux command-line environment before, you can learn the basics by reading this article.

Verifying the Drush installation

To verify that Drush is installed and functioning correctly on your account, follow these steps:

Change to the directory where Drupal is installed. For example, if you installed Drupal in the document root directory, type the following command:

cd ~/public_html

Alternatively, if you installed Drupal in a subdirectory, change to that directory instead.

All of the following commands in this article assume that you are running Drush in the directory where Drupal is installed. Most of these commands will not work if you run Drush from a different directory.

Type the following command:

drush status

Drush should display information about your Drupal installation that resembles the following output (specific values will vary):

Drush is installed on all shared hosting servers by default. If Drush does not work on your account, please open a support ticket on the A2 Hosting Customer Portal at https://my.a2hosting.com.

Configuring Drupal modules

A common Drupal administration task is module configuration. This is often done through Drupal's web administration interface. However, you can also quickly and easily work with Drupal modules on the command line.

For example, if you need to download and enable several modules, it is much quicker to do this on the command line with Drush than it is to click through the various Drupal web administration pages.

Downloading modules

To download a Drupal module, type the following command in the directory where Drupal is installed. Replace MODULE with the name of the module that you want to download:

drush dl MODULE

To download several modules at once, just add them to the end of the command. For example, to download the views and token modules at the same time, type drush dl views token.

Some Drupal modules, such as composer_manager, have additional PHP configuration requirements (for example, allow_url_fopen must be enabled). On some servers, you may receive an error message when you try to download or enable these modules. To resolve this problem, follow these steps: