Subscribe To Our NewsLetter
Share This Post:
What is Drush?
Many of you must heard about this term and many might not. So, Drush aka The Drupal Shell, is a command line utility and UNIX scripting interface for Drupal. It allows access to common features of Drupal and tasks as well via command line. Moreover, it can help speed up common tasks for Drupal site-builder, developers and DevOps team.
You know, Drush is awesome ? You can increase your productivity and save a lot of clicking time in drupal admin interface by keeping the Drush commands on your finger tips. You may feel overwhelmed due to the large number of commands available in Drush. But it’s just matter of few days, once you start using them, then the life will become easy. Here are our favourite Drush commands that we use every single day when developing Drupal websites.
This one is the most commonly used drush command. You need it often while creating drupal modules to clear the cache (for ex, when adding a new menu item in hook_menu). You can clear all caches with drush cc all, or choose a specific one with drush cc
drush cc all
This command shows you list of modules and themes that are available for your Drupal site. If you want to check which module is enabled then you can quickly do it with the help of this command. You can use pml in combination with grep to see if the module you are looking for exists in the site. And with the grep, you don’t even need to know the full module name.
drush pm-list | grep modulename
drush pm-list | grep boost
This will find any module or theme with boost in the name. There are chances of getting more than one result because it will show your all the names which includes the boost keyword in it.
UNDO, the easy nickname for this command ? If you decide you don’t want to keep the changes that you have made, you can run feature-revert to bring it back to the previous version.
drush feature-revert feature_name
Update DB is used to run the pending database updates. This is normally required if you update module code and that module needs to update the database. This saves you from running updates via update.php.
If you have a Feature and you change something that is stored in that Feature (e.g. you update a View), you will need to update it. This will export the components to code. Rather than manually exporting the feature in the admin interface, you can just run feature-update.
drush feature-update feature_name
Quickly see the value of a particular variable, use variable_get
drush variable_get variable_name
You need new modules, theme everyday for your work. And to get it, rather than going to drupal.org to download them, use pml-download with the module or theme name.
drush pm-download project_name
To check all the errors and warnings, rather than going to the watchdog page to see errors and warnings, you only have to run watchdog_show.
pm-enable (en) & pm-disable (dis)
Once a new module or theme has been downloaded, it needs to be enabled. We do it with the pm-enable command, instead of going to the module page.
drush pm-enable project_name
And to disable the same thing, use the following command.
drush pm-disable project_name
Easy way to Update Drupal core, modules and themes.
How often you use these commands?
If you are still not using Drush, let us know the reason, we can guide you. Very soon we are going to share the detailed technical guide for more drush commands as we love to use it and want every Drupal Expert to use it.
Interested to know more about our Drupal Experience ? Talk to us
LN WebworksYour Drupal Solution Partner
LN Webworks have championed open-source technologies for nearly a decade, bringing advanced engineering capabilities and agile practices to some of the biggest names across media, entertainment, education, travel, hospitality, telecommunications and other industries.