Drush useful commands cheatsheet

  1. # Cache clear all
  2. drush cc all
  3.  
  4. # Cache clear css + js
  5. drush cc css-js
  6.  
  7.  
  8. #------------------------------------------------------------------------------------------
  9. # Reset Drupal admin password
  10.  
  11. drush upwd admin --password="admin"
  12.  
  13. # Get an admin one-time login link
  14. drush uli
  15.  
  16.  
  17. #------------------------------------------------------------------------------------------
  18. # Modules management
  19.  
  20. # Download & enable
  21. # (auto-detects subdir "contrib" in modules directory when present)
  22. drush dl token
  23. drush en token -y
  24.  
  25. # Disable
  26. drush dis token -y
  27.  
  28. # Upgrade a module (requires core module "update" enabled)
  29. drush up token -y
  30.  
  31. # Upgrade everything (requires core module "update" enabled)
  32. drush up -y
  33.  
  34. # Reinstall (requires module "devel" enabled)
  35. drush devel-reinstall token -y
  36.  
  37.  
  38. #------------------------------------------------------------------------------------------
  39. # Features
  40.  
  41. # Export example (create new OR update a feature module)
  42. # @see http://highrockmedia.com/blog/features-drush-drupal-goodness
  43. drush fe events_feature views:latest_events
  44.  
  45. # Note : after exporting in a feature once, if you want to add stuff (re-export) in this same feature,
  46. # it's mandatory to enable the feature first -- to carry on with our example :
  47. drush en events_feature -y
  48.  
  49. # Build components list (the configuration available to features)
  50. drush fc
  51. drush fc --all
  52.  
  53. # Update a feature
  54. # (write current site configuration into files)
  55. drush fu events_feature -y
  56.  
  57. # Update all features
  58. # (write current site configuration into files)
  59. drush fua
  60.  
  61. # Revert a feature
  62. # (replace current site configuration with the ones loaded from files)
  63. drush fr events_feature
  64.  
  65. # Revert all features
  66. # (replace current site configuration with the ones loaded from files)
  67. drush fra
  68.  
  69. # List all features
  70. drush fl
  71.  
  72.  
  73. #------------------------------------------------------------------------------------------
  74. # Variables
  75.  
  76. # List / find variables - ex. with pathauto :
  77. drush vget | grep pathauto
  78.  
  79.  
  80. #------------------------------------------------------------------------------------------
  81. # Configuration
  82.  
  83. # Set variable value
  84. drush vset maintenance_mode 0 --yes
  85.  
  86. # Delete variable
  87. # ex: cron variables (useful when stuck)
  88. drush vdel cron_semaphore
  89. drush vdel cron_last
  90.  
  91.  
  92. #------------------------------------------------------------------------------------------
  93. # Localization update (l10n_update)
  94.  
  95. # Create / update cache
  96. drush l10n-update-refresh
  97.  
  98. # Update translations
  99. drush l10n-update -y
  100.  
  101.  
  102. #------------------------------------------------------------------------------------------
  103. # Solr
  104.  
  105. # Delete index
  106. drush solr-delete-index
  107.  
  108. # Index
  109. drush solr-index
  110.  
  111.  
  112. #------------------------------------------------------------------------------------------
  113. # Migration
  114.  
  115. # Status
  116. drush ms
  117. drush ms my_migration_name
  118. # Recognize new migrations and update counts
  119. drush ms --refresh
  120.  
  121. # Operations : Import / Update / Rollback & Import
  122. drush mi --all
  123. drush mi --group="my_group_name"
  124. drush mi my_migration_name
  125. # Ignore unmet dependencies
  126. drush mi my_migration_name --force
  127. drush mi my_migration_name --update
  128. # Rollback before importing
  129. drush mi my_migration_name --rollback
  130. # Number of items to import
  131. drush mi my_migration_name --limit="2"
  132. # List (CSV) of source IDs to import
  133. drush mi my_migration_name --idlist="123,124"
  134.  
  135. # Operations : Rollback
  136. drush mr --all
  137. drush mr my_migration_name
  138.  
  139. # Wipe : Delete all nodes from specified content types,
  140. # with space delimited list of content type machine readable Ids as argument
  141. drush mw content_type_name other_content_type_name
  142.  
  143. # Audit
  144. drush ma my_migration_name
  145.  
  146. # Analyse
  147. drush maz my_migration_name
  148.  
  149. # View messages
  150. drush mmsg my_migration_name
  151.  
  152. # Mappings
  153. drush mm my_migration_name
  154.  
  155.  
  156. #------------------------------------------------------------------------------------------
  157. # Devel
  158.  
  159. # Generate 12 users
  160. drush genu 12
  161.  
  162. # Generate 25 nodes
  163. drush genc 25
  164. # Generate 25 nodes of type "book" and "page" only
  165. drush genc 25 --types="book,page"
  166. # Generate 25 nodes leaving out "field_my_test" and "field_foobar" fields (no values)
  167. drush genc 25 --skip-fields="field_my_test,field_foobar"
  168.  
  169. # Generate 1 vocabulary (default qty is 1)
  170. drush genv
  171.  
  172. # Generate 32 terms in "my_voc_name"
  173. drush gent my_voc_name 32
  174.  
  175. # Generate menus
  176. drush genm
  177.  
  178.  
  179. #------------------------------------------------------------------------------------------
  180. # Backup & migrate (requires module "backup_migrate" enabled)
  181. # @see http://www.only10types.com/2011/03/drush-backup-and-migrate-command.html
  182.  
  183. # Create dump (default settings)
  184. drush bb
  185.  
  186. # List manual dumps
  187. drush bam-backups
  188.  
  189. # Restore manual dump
  190. drush bam-restore db manual "Your.Site-01.01.2012-12.00.00.mysql.gz"


Article Information
Article ID Categories Tags Levels Status
#43
Free
Solved