drush
DESCRIPTION
A "quick" introduction to drush, the Drupal command line tool.TRANSCRIPT
![Page 1: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/1.jpg)
drusha "quick" introduction
![Page 2: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/2.jpg)
What is it?
The Drupal shell Allows interaction with a Drupal site via command line Easy to use Really useful (honest!)
![Page 3: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/3.jpg)
Installing
Linux/OSXpear channel-discover pear.drush.orgpear install drush/drush
May have to run with sudo Might also have to run pear upgrade-all Can also use apt-get (might not be up to date)
![Page 4: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/4.jpg)
Installing
Windows Installer Available www.drush.org/drush_windows_installer Used to be almost unusable but appears to be better.
![Page 5: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/5.jpg)
Using Drush
![Page 6: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/6.jpg)
drush
Prints a list of available drush commands Good to see if you have installed it or not
![Page 7: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/7.jpg)
drush help <command>
Prints out help text for a command.
![Page 8: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/8.jpg)
drush status
Shows current status of a drupal site Or just the version of drush if no site is found
![Page 9: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/9.jpg)
drush pm-list
List currently installed modules and themes Use --status to filter the list by status. Example:drush pm-list --status=enabled
![Page 10: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/10.jpg)
drush pm-download <project>
Downloads projects from Drupal.org Includes projects, themes and even Drupal itself Use the --select to prompt for a certain release Can be shortened to "drush dl"
![Page 11: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/11.jpg)
drush pm-releases <project>
List the releases for a project Helpful when using pm-download
![Page 12: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/12.jpg)
drush site-install <profile>
Install a site from the command line. --account-name to set master user username--account-pass to set master user password--db-url to set database connection string Example:drush site-install minimal --account-name=admin --account-pass=admin --db-url=mysql://root:QWEqwe123@localhost/drupal7
![Page 13: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/13.jpg)
drush pm-enable <extension>
Enable a module or theme. Use --yes to assume "yes" to prompts Can be shortened to "drush en <extension>"
![Page 14: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/14.jpg)
Live Demo!Full site install from the command line
![Page 15: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/15.jpg)
drush pm-disable <extension>
Disable a module or theme. Can be shortened to "drush dis <extension>"
![Page 16: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/16.jpg)
drush pm-uninstall <extension>
Completely remove a module from Drupal Basically runs the uninstall hooks
![Page 17: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/17.jpg)
drush pm-updatecode <project>
Update the code of an project Use --security-only to only get security releases Updates the code only, use "drush updatedb" to also apply any database updates
![Page 18: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/18.jpg)
drush pm-update <project>
Updates a projects code and applies any database updates Same as running pm-updatecode and updatedb
![Page 19: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/19.jpg)
drush cache-clear all
Clear all caches Can use shortcut "drush cc all" Specify type of cache to clear or leave blank to prompt for one
![Page 20: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/20.jpg)
drush core-cron
Run the cron Can also use "drush cron"
![Page 21: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/21.jpg)
Interacting with search
drush search-index drush search-reindex drush search-status Note: Need to have search module enabled!
![Page 22: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/22.jpg)
Interacting with users
drush user-block username drush user-unblock username drush user-password username --password=password drush user-information username
![Page 23: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/23.jpg)
Interacting with the database
drush sql-drop drush sql-dump --result-file=../mysite.sql drush sql-query --file=../mysite.sql
![Page 24: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/24.jpg)
...and many more
Barely scratched the surface here *Lots* more commands and flags available For a full list see: http://www.drush.org/help/5
![Page 25: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/25.jpg)
Drush Make
![Page 26: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/26.jpg)
Drush Make
Sort of like install profiles Single subject in itself Uses a 'make' file to download all needed modules Makes version control easier
![Page 27: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/27.jpg)
drush make-generate <makefile>
Generate a make file from an existing Drupal install No need to know the make file syntax inside and out Example:drush make-generate mysite.make
![Page 28: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/28.jpg)
Example Make File; This file was auto-generated by drush makecore = 7.x api = 2projects[drupal][version] = "7.x" ; Modulesprojects[ctools][version] = "1.0" projects[devel][version] = "1.2" projects[google_analytics][version] = "1.2" projects[views][version] = "3.3"
![Page 29: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/29.jpg)
drush make <makefile>
Make a drush site using a make file Example:drush make mysite.make
![Page 30: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/30.jpg)
MOAR!!!I can haz moar commands?
![Page 31: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/31.jpg)
Drush API
Drush has an API and so modules can plug in to drush and allow additional commands Reference site:http://api.drush.org/api/drush
![Page 32: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/32.jpg)
Views
Interact with views from Drush drush views-list drush views-enable <view> drush views-disable <view>
![Page 33: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/33.jpg)
Devel Generate
Adds devel generate support for drush Create 10 nodes:drush generate-content 10 Create 10 nodes, with 5 (or less) comments:drush generate-content 10 5 (Make sure comment is enabled!)
![Page 34: Drush](https://reader034.vdocuments.us/reader034/viewer/2022052618/548da045b47959640d8b4809/html5/thumbnails/34.jpg)
Resources
Drush Project Pagewww.drupal.org/project/drush Main Drush Sitewww.drush.org Drush APIapi.drush.org/api/drush