LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

drush

command-line shell for Drupal

TLDR

Clear all caches
$ drush cache:rebuild
copy
Enable and install a module
$ drush pm:install [module_name]
copy
Update database
$ drush updatedb
copy
Run cron
$ drush cron
copy
Show site status
$ drush status
copy
Export configuration
$ drush config:export
copy
Import configuration
$ drush config:import
copy
Generate one-time login link
$ drush user:login
copy
Dump the database to a SQL file
$ drush sql:dump --result-file=[dump.sql]
copy
Open an interactive SQL shell
$ drush sql:cli
copy

SYNOPSIS

drush command [options] [arguments]

DESCRIPTION

Drush (Drupal Shell) is the command-line interface for Drupal, providing tools for site administration, development, and deployment. It's essential for Drupal developers and administrators.The tool handles cache clearing, module management, database updates, configuration synchronization, and user administration. Short aliases (cr, cex, cim) provide quick access to common commands.Drush supports site aliases for managing multiple Drupal sites and integrates with deployment workflows for configuration management.

PARAMETERS

COMMAND

Drush command to execute.
cache:rebuild, cr
Clear all caches.
pm:install NAME, en
Enable and install a module.
pm:uninstall NAME, pmu
Uninstall a module.
updatedb, updb
Apply database updates.
config:export, cex
Export configuration.
config:import, cim
Import configuration.
user:login, uli
Generate login link.
sql:dump
Export database to a SQL file.
sql:cli, sqlc
Open an interactive SQL shell using Drupal credentials.
status, st
Show site information.
--yes, -y
Auto-accept confirmations.
--uri URI
Drupal URI for multi-site setups.
--help
Display help information.

CONFIGURATION

~/.drush/drush.yml

User-level Drush configuration for default options and aliases.
drush/drush.yml or drush/sites/.yml
Project-specific Drush configuration files in Drupal root.
**/drush/sites/*.site.yml**
Site alias definitions for managing multiple Drupal sites.

CAVEATS

Requires Drupal installation. Must run from site root or use aliases. Version must match Drupal version. Some commands need database access.

HISTORY

Drush was created by Moshe Weitzman and others in 2007 for Drupal 5. It has evolved alongside Drupal, becoming the standard CLI tool for Drupal administration and development.

SEE ALSO

drupal(1), composer(1), php(1)

Copied to clipboard
Kai