Backend and Infrastructure

Use Drush for Common Site and Environment Management Tasks for Drupal 8, 9, and 10

Administration and maintenance of Drupal websites consists of many tasks that can both be performed via the command line, and automated, with Drush. Using Drush's site and environment administration commands you can run database updates, check an environment's status, clear (rebuild) the cache, perform Cron-related operations, and manage users. These tasks are repetitive, often require many steps in the UI, and may be tedious in the long run. Learning to execute them with Drush can save you time and allows for more automation of common tasks.

In this tutorial we'll:

  • Use Drush to check a site's status
  • Learn how to perform database updates with Drush
  • Clear the Drupal cache with Drush
  • Use Drush to execute Cron tasks for a Drupal site
  • Learn how to use Drush to login to a site as any user, and manage existing users

By the end of this tutorial you'll be able to perform many common Drupal environment and administration tasks from the command line with Drush. We're not going to cover all of the environment management commands in this tutorial, just some of the more popular ones. We encourage you to explore further on your own.