Introduction to Drush - DrupalCamp London 2014


Published on

Presentation at DrupalCamp London 2014 about using Drush, the Drupal shell.
Audio/video available here:

Published in: Technology
1 Comment
1 Like
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Lists modules and themes for a site, their versions and whether endbled/disabled
  • Shows detailed info about one or more modules or themes
  • Remember you can use aliases with anydrush command, like getting status of remote site
  • Remember you can use aliases with anydrush command, like getting status of remote site
  • Short versions are ublk to block, uublk to unblock
  • Short versions are ublk to block, uublk to unblock
  • Short versions are ublk to block, uublk to unblock
  • Short versions are ublk to block, uublk to unblock
  • Short versions are ublk to block, uublk to unblock
  • Defaults to uid 1
  • Defaults to uid 1
  • Short versions are ublk to block, uublk to unblock
  • Introduction to Drush - DrupalCamp London 2014

    1. 1. Introduction to Drush $ @anthonyalbertyn $ #dclondon $z
    2. 2. What is Drush?  Drush = Drupal Shell  Command line interface  Scripting environment that can be extended  Toolbox of useful utilities
    3. 3. Why use Drush?  Can be massively more productive than using a GUI  Access drush commands supplied by contrib modules
    4. 4. What can Drush do?  Perform tasks with modules, themes, profiles, translations and core: - download, enable, update, - disable and uninstall  Add, remove and manage users
    5. 5. What else can Drush do?  Various admin tasks like clear cache, run cron, re-index search  Database related tasks like backup database, migrate databases between different sites
    6. 6. What do we need to use Drush locally ?  Install Drush on your pc/mac  Terminal / Windows Command Processor (command prompt)
    7. 7. What do we need to use Drush remotely ?  Install Drush on server  SSH client - for Mac use Terminal - for Windows install and use PuTTY
    8. 8. Options for installing Drush     Use PEAR (preferred way) Install Drush manually There are other ways too Instructions for various environments:
    9. 9. Two ways to use Drush  Navigate to your Drupal root directory on local or remote site and type: drush [command]  Setup a Drush site alias and locally from anywhere in Terminal type: drush @[alias] [command]
    10. 10. List useful Drush commands drush help
    11. 11. Download modules drush dl omega drush dl date context ds
    12. 12. Enable modules drush en omega drush en date context ds
    13. 13. Disable modules drush dis omega drush dis date context ds
    14. 14. Uninstall modules drush pm-uninstall omega drush pm-uninstall date ds
    15. 15. List modules and themes on site drush pm-list
    16. 16. More info on module in site drush pm-info context
    17. 17. Clear the cache drush cc drush cc all
    18. 18. Run cron on your site drush cron
    19. 19. Search status – how many items still need indexing drush search-status
    20. 20. Search index – index remaining search items without wiping out the existing index drush search-index
    21. 21. Search re-index – force the search index to be re-built drush search-reindex
    22. 22. List available site aliases drush sa
    23. 23. Show status of a site drush status drush @alias status
    24. 24. Get info about an existing user drush user-information username drush user-information userid drush user-information useremail
    25. 25. Block and unblock a user drush user-block username drush user-unblock username
    26. 26. Create a new user drush user-create username --mail=“” --password=“password123”
    27. 27. Give a user a role drush user-add-role ”user role” username
    28. 28. Set a new password for a user drush user-password username -password=“newpass123”
    29. 29. One-time login link for a user drush uli username drush @alias uli username
    30. 30. Delete a user account drush user-cancel username
    31. 31. Update drupal core and contrib modules to latest recommended releases and apply pending database updates drush up
    32. 32. Dump database into sql file drush sql-dump > /path/to/ myfile.sql
    33. 33. Copy entire database from one environment to another drush sql-sync @site1 @site2
    34. 34. Sync files folder content from one site to another drush rsync @site1:%files @site2:%files
    35. 35. More info on deploying sites drush help site-alias drush help sql-sync drush help rsync
    36. 36. Setup and use Drush aliases  Blog post about Drush aliases  Synchronise and deploy sites  Example of valid alias statements hp
    37. 37. Manual installation on Mac  Download Drush from GitHub  Unpack into home directory /Users/username  Grant yourself file execution permissions chmod u+x /Users/username/drush/drush
    38. 38. Manual installation on Mac  Tell OS X where to find Drush:  Add drush path to your $PATH - via Terminal - or Bash - or Profile  OR create a symbolic link to the path
    39. 39. Mac – add Drush to path  Example: In directory /Users/username, edit .profile and add: export PATH=$PATH:/Users/username/drush/drush
    40. 40. Mac – create symbolic link  Example sym link: cd /usr/bin ln –s /Users/username/drush/drush  More info mac installation:
    41. 41. Test that Drush works  Open your Terminal and type drush --version  To display a list of helpful drush commands: drush help
    42. 42. Learning resources  Drush User’s Guide (book) Novillo, J.P, Packt Publishing, 2012 ISBN 978-1-84951-798-0  Drush for Humans – SANDcamp 2013 Presenter: Jon Peck
    43. 43. Learning resources  Drush optimizations for your development workflow – DrupalCon Prague 2013 Presenters: various
    44. 44. Drush resources  Drush commands  Drush GitHub project  Drush Windows installer  Drush API docs
    45. 45. About me  @anthonyalbertyn  Front-end web developer  Co-founder and organiser of #drupalcambs 