Every release of Drupal requires its own version of Drush. There are some, but not many, changes for Drush moving from Drupal 7 to Drupal 8. Drush 8 can be used to control the new configuration management system. One change to look out for is that Drush cache-clear (cc) has joined forces with Drush registry-rebuild (rr) to become Drush cr, or cache-rebuild, in Drupal 8.
Understand Drush
Short for Drupal Shell, Drush is a tool that allows developers to work on the command line, an interface that has both benefits and disadvantages to the Drupal UI (user interface). Some tasks, such as building Views, can be done faster in the UI, and some tasks, such as exporting views to a feature, are done faster on the command line. Drush is less of a replacement for the UI and more of a companion to it.
You might even say Drush stands for Drupal Rush because it speeds up the process so nicely. Basically, Drush offers a way around the Drupal user interface. You no longer have to click through the Drupal menu when you use Drush.
Using Drush, developers can import and export databases and features, clear caches, and migrate content from data feeds. Drush can also install modules, run security updates, and run database updates. Developers can also write and implement their own Drush commands.
To start using Drush, there are many different ways to install the setup. One way you can proceed is to install a LAMP stack (Linux, Apache, MySQL, and PHP/Python/Perl), then install Composer, and finally you can install Drush. Here’s a good tutorial.
Sound like a lot of steps? Maybe, but once you use it, there’s no going back. Dan Zinkevich, one of our staff developers, says, “I use Drush a lot during development. There are times when I can go a long time without opening my browser because all the commands that I need are available via Drush.” Dan recommends that Drupal developers learn Drush immediately, especially if they are committing code to a database.
Learning to use Drush is a bit like learning a language. There are dozens of commands. And there are also many plug-in commands from third party sources. Here’s a helpful site that breaks down commands by Drush version, and provides documentation for each.
Go Faster. Add Fetcher.
If you build a lot of sites, then you end up with a lot of repetitive tasks. There are commands a developer runs repeatedly. Zivtech’s VP of Engineering, Howard Tyson, is a major fan of automation. He created Drush Fetcher, an extension that automates the process of provisioning a Drupal site on a local development environment or a server. “It used to take 30 to 45 minutes to set up a site, and now it takes 3 minutes,” explains Howard. “Fetcher doesn’t take away the cognitive load. It takes away the monkey work.”
Fetcher can set up the Drupal root, fetch the code, create a database for the site and a user with management privileges, update permissions, create symlinks, set up server configuration files, and generate Drush alias files. Fetcher also supports post installation tasks.
Drush and Fetcher are not about cutting corners. They simply bypass the web interface of Drupal. You don’t have to click through the menu to get the actions you want. And that’s a huge time saver.