Drush - Drupal Command Line Shell
Drush is an indispensable command-line shell and scripting interface for Drupal. It significantly streamlines common tasks for developers and site administrators, making Drupal development and management more efficient. This tool allows for rapid development, maintenance, and administration of Drupal websites directly from your terminal.
Drush Command Overview
Drush provides a wide array of commands to manage your Drupal site. Below is a summary of frequently used Drush commands, categorized for clarity.
Core Drupal Management Commands
##############################################################################
# DRUSH
# Install: https://www.drush.org/install/
# Usage: https://www.drush.org/usage/
##############################################################################
cache clear (cc) # Clear all caches.
cron # Run all cron hooks.
disable (dis) # Disable one or more modules.
enable (en) # Enable one or more modules.
installcore (ic) # Install Drupal core via the specified install profile. Note that updating core with Drush is not yet available. See http://drupal.org/node/434944.
refresh (rf) # Refresh update status information script Runs the given php script(s) after a full Drupal bootstrap. NOTE: you can't supply absolute paths to the script e.g. ~/Desktop/script.php won't work Desktop/script.php will
status (st) # Provides a birds-eye view of the current Drupal installation, if any.
statusmodules (sm) # Show module enabled/disabled status
uninstall # Uninstall one or more modules.
update (up) # Update your project code and apply any database updates required (update.php)
updatecode (upc) # Update your project code. Moves existing project files to the backup directory specified in the config.
updatedb (updb) # Execute the update.php process from the command line.
variable delete (vdel) # Delete a variable.
variable get (vget) # Get a list of some or all site variables and values.
variable set (vset) # Set a variable.
watchdog delete (wd) # Delete all messages or only those of a specified type.
watchdog show (ws) # Shows recent watchdog log messages. Optionally filter for a specific type.
Module and Project Management
download (dl) # Download core Drupal and projects like CCK, Zen, etc.
info # Release information for a project
Database Operations
sql cli (sqlc) # Open a SQL command-line interface using Drupal?s credentials.
sql conf # Print database connection details.
sql connect # A string for connecting to the DB.
sql dump # Exports the Drupal DB as SQL using mysqldump.
sql load # Copy source database to target database.
sql query (sqlq) # Execute a query against the site database.
Development and Testing
eval # Evaluate arbitrary php code after bootstrapping Drupal.
test clean # Delete leftover tables and files from prior test runs.
test mail # Run all tests and mail the results to your team.
Site Synchronization
sync # Rsync the Drupal tree to/from another server using ssh.
Getting Started with Drush
To begin using Drush, you first need to install it. The official Drush website provides comprehensive installation instructions for various operating systems and environments. Once installed, navigate to your Drupal project's root directory in your terminal and start executing commands. For detailed usage and command options, refer to the official Drush documentation.