knackforge
June 30, 2012
If you are into Drupal development and a vivid user of GNU/ Linux (or *nix) for a while, then Drush is a must-learn tool for you. As a part of the Drupal development project, we extensively use Drush. A few commands that help us develop sites at the phase of the client's expectation are briefed below,
1. drush cc [type]:- Clears a specific cache or all Drupal caches.
Example
$ drush cc all
$ drush cc menu
2. drush sql-sync:- Copy and import source database to target database. Transfers via rsync
Example
$ drush sql-sync @dev.mysite @local.mysite
3. drush sql-dump:- Exports the Drupal DB as SQL using mysqldump
Example
$ drush sql-dump > /path/to/backup_dir/database-backup.sql
4. drush sql-connect:- Gives string for connecting to DB
Example
$ drush sql-connect
$ `drush sql-connect`
Example
To rsync the entire site
$ drush rsync @dev @stage
$ drush rsync @dev:%files @stage:%files
$ drush pm-list
$ drush dl views
$ drush dis overlay
$ drush en -y views
$ drush scr filename.php
10. drush features-list:- List all the available features for your site.
Example
$ drush features-list
$ drush features-revert frontpage
$ drush sql-drop
Do you really want to drop all tables(y/n) :
Drupal version : 7.12Site URI : http://defaultDatabase driver : mysqlDatabase hostname : localhostDatabase username : rootDatabase name : exampleDatabase : ConnectedDrupal bootstrap : SuccessfulDrupal user : AnonymousDefault theme : customAdministration theme : sevenPHP configuration : /etc/php5/cli/php.iniDrush version : 4.5Drush configuration :Drush alias files : /home/user/.drush/example.alias.drushrc.phpDrupal root : /home/user/Public/projectSite path : sites/defaultFile directory path : sites/default/files
14. drush cron:- Triggers drupal cron run.
Example
$ drush cron
Cron run successfully. [success]
Just like how your fellow techies do.
We'd love to talk about how we can work together
Take control of your AWS cloud costs that enables you to grow!