Skip to main content

Useful Drush Commands

Submitted by system on

Log out all active Users

drush sql-query 'TRUNCATE TABLE sessions;' 

Download drupal and rename: Downloads and renames to web
drush dl drupal --drupal-project-rename=web -y
Install Drupal database: Installs drupal when executed inside the drupal folder.
drush site-install --db-url=mysql://dbuser:dbpass@localhost/dbname --account-name=admin --account-pass=secret -y
Install Specific version of drupal module: Select a version of the module to install. Useful when installing older versions --select allows for selection --all lists all versions instead of recent ones.
drush pm-download modulename --select --all
Locking a module so that it does not get updated with drush update: here are a number of reasons why you might not want to update some module on your site; a module will change in a way that you don't like. The lock is persistent; you will not be able to update the locked module unless you unlock it with --unlock=module_name or --unlock=all
drush pm-updatecode --lock=modulename
Drupal 8 Enable and Set Default a theme called atlas:
drush config-set system.theme default atlas
Backup databases and zip it to a location
drush sql-dump --gzip --result-file=/pathtofile/databasefilename.sql
Delete Shortcut Entity Links
drush ev '\Drupal::entityTypeManager()->getStorage("shortcut_set")->load("default")->delete();'
-- http://orga.cat/posts/most-useful-drush-commands https://stefvanlooveren.me/blog/remove-shortcut-links-drush-drupal-10 Definitive Guide to Drupal https://www.lullabot.com/articles/drupal-8-theming-fundamentals-part-1

Technologies