Drupal AnswersWhat can Drush do that the web interface can't?
[+7] [2] Grant Palin
[2011-03-02 21:10:21]
[ drush ]

I'm aware that Drush is a powerful command-line tool for managing a Drupal site. What uses have you gotten from it that go beyond what you can do in the Drupal interface?

Do you mean "What can you do with Drush that goes beyond what you can do through the Drupal web interface?" or "Can Drush be used for things besides Drupal?" - Greg
@Greg I edited the question to make it more specific. - Grant Palin
[+16] [2011-03-03 05:21:40] nowarninglabel [ACCEPTED]

This is a good question because some people question how much more effective drush can make you, and the answer is, "ninja works it".

We needed to delete all nodes of a certain content type. No, you can't just go into MySQL command line and run "delete from node;" and expect good things to happen. So we wrote a quick plugin to drush and bam

    $ drush node-deletebytype article
    >63 nodes deleted 

Can you imagine if you had do selects on the checkboxes in the admin interface for that? What if you had 6000 nodes (as we often did when importing lots of content). If you don't want to write your own plugin, the Delete All [1] 6.x-dev version has drush integration, and there is a patch available for D7.

But wait, that's not all, you also get the great combination of using drush and piping the output to other commands like grep. Let's say I have a big development site testing out lots of new features and I can't remember all the facebook modules I'm trying out, well drush to the rescue:

    $ drush pm-list | grep -i facebook
     Drupal for Facebook - contrib  Register Users (fb_register.module) (fb_register)              Module  Not installed  6.x-3.0-rc3     
     Drupal for Facebook - contrib  Rules Integration (fb_rules.module) (fb_rules)                 Module  Not installed  6.x-3.0-rc3     
     Facebook connect               Fbconnect Events (fbconnect_events)                            Module  Disabled                       
     Facebook Social                Facebook Friends Invite (fbconnect_invite)                     Module  Not installed  6.x-2.0-beta1 

But wait, that's not all, it slices [out your sql queries for text usage]

drush sql-query "select * from users;" > userlist.txt

It dices out those bad seeds [of code that give you a white screen of death and thus prevent you from disabling via the admin interface]

drush dis that_custom_module_with_mo_code_mo_probs

But wait! It juliennes [those files and dbs and sends them to prod] too!

drush rsync demosite.drupal6.local @peer
drush sql-sync demosite.drupal6.local @peer

And oh my, I just learned it can work on remote sites using aliases such as the above so we can turn

drush status


drush @dev status

Drush (as seen on, it's better than sliced bread. Get yours today!


Love this answer. Can you rework all docs like this? - geerlingguy
Hah! =D Well, I have actually gotten involved now in some doc changes, but this here was more a moment of inspiration ;) - nowarninglabel
Awesome commercial - way to sell it to me! - Grant Palin
What a kook! That was funny. Why was this post closed? The open ended questions like these are usually the most interesting to read on programming topics. The other type, "Why does the dongle need to be set to x?", is really really boring... My2c - xtian
[+6] [2011-03-02 21:13:34] geerlingguy

I use Drush to manage automated importing and migration of data on a daily basis for I have a shell script that uses Drush to delete a set of migrated nodes, then reimport the nodes.

I also use Drush to run cron on some of my sites, and to clear caches. (Running drush commands from crontab is better, in many ways, then running wget on Drush in combination with Drupal Queue, Elysia Cron, and a few other helpful modules == performance and optimization WIN!

One of the easiest and most helpful uses of drush is to perform updates of your site, clear caches, etc.

Have a read through and see if you can find some cool commands to help your life easier.

The question was about uses of drush "beyond drupal". All your responses are about drupal uses. Not a knock on you. I think question is vague to say the least. "Beyond Drupal" you have the whole bash shell, shell scripting, PERL, Python or whatever you want to do. - community_owned
@winston - Perhaps by "beyond Drupal" the OP means: What can you do with Drush that goes beyond what you can do through the Drupal interface? - Greg
@Greg quite so. I edited the question to better reflect that intent. - Grant Palin
Using it for data migration is good to know. Thanks for the link. - Grant Palin