Drush Commands Print

  • 0

Basic Site Information

  • Get Drupal version: drush status
  • List installed modules/themes: drush pm-list

Cache Management

  • Clear cache: drush cache-clear all or drush cr (Drupal 8+)
  • Rebuild cache: drush cache-rebuild

Module and Theme Management

  • Enable module: drush pm-enable module_name or drush en module_name
  • Disable module: drush pm-disable module_name or drush dis module_name
  • Uninstall module: drush pm-uninstall module_name
  • Download module/theme: drush pm-download module_name or drush dl module_name
  • Update module/theme: drush pm-update module_name or drush up module_name

Database Management

  • Export database: drush sql-dump --result-file=path/to/dump.sql
  • Import database: drush sql-cli < path/to/dump.sql
  • Connect to database: drush sql-connect

User Management

  • View user list: drush user-list
  • Block user: drush user-block username
  • Unblock user: drush user-unblock username
  • Add role to user: drush user-add-role "role" username
  • Remove role from user: drush user-remove-role "role" username
  • Change user password: drush user-password username --password="newpassword"

Configuration Management

  • Export configuration: drush config-export or drush cex
  • Import configuration: drush config-import or drush cim
  • Edit configuration: drush config-edit

Content Management

  • Create node: drush create-node "title" --type="content_type"
  • Delete node: drush node-delete nid
  • View node: drush node-view nid

Cron and Maintenance

  • Run cron: drush cron
  • Enable maintenance mode: drush sset system.maintenance_mode 1
  • Disable maintenance mode: drush sset system.maintenance_mode 0

Miscellaneous

  • Run SQL queries: drush sql-query "SELECT * FROM table_name"
  • Clear logs: drush watchdog-delete all
  • Show watchdog logs: drush watchdog-show

  • drush watchdog:tail. Continuously tail watchdog messages.
  • drush watchdog:tail "cron run successful". Continuously tail watchdog messages, filtering on the string cron run successful.
  • drush watchdog:tail --severity=Notice. Continuously tail watchdog messages, filtering severity of notice.
  • drush watchdog:tail --severity-min=Warning. Continuously tail watchdog messages, filtering for a severity of warning or higher.
  • drush watchdog:tail --type=php. Continuously tail watchdog messages, filtering on type equals php.

 


Was this answer helpful?

« Back