Drush commands reference
Last updated by ijf8090 on Fri, 2020-07-17 23:33
Run drush help [command] to view command-specific help.
Examples:
drush dl cck zen Download CCK module and Zen theme.
drush --uri=http://example.com status Show status command for the example.com multi-site.
drush help --pipe A space delimited list of commands
For details on command flags(e.g. drush sql-dump --skip-tables-key=common), see http://drush.ws/ or drush help command-name
Options:
| Option | Description |
|---|---|
| -r , --root= | Drupal root directory to use (default: current directory) |
| -l , --uri= | URI of the drupal site to use (only needed in multisite environments) |
| -v, --verbose | Display extra information about the command. |
| -d, --debug | Display even more information, including internal messages. |
| -q, --quiet | Hide all output |
| -y, --yes | Assume 'yes' as answer to all prompts |
| -s, --simulate | Simulate all relevant actions (don't actually change the system) |
| -i, --include | A list of paths to search for drush commands |
| -c, --config | Specify a config file to use. See example.drushrc.php |
| -u, --user | Specify a user to login with. May be a name or a number. |
| -b, --backend | Hide all output and return structured data (internal use only). |
| -p, --pipe | Emit a compact representation of the command for scripting. |
Commands:
| Command (shortcut in parentheses) | Description |
|---|---|
| help | Print this help message. Use --filter to limit command list to one command file (e.g. --filter=pm) |
| cron | Run all cron hooks. |
| updatedb (updb) | Execute the update.php process from the command line |
| status (st) | Provides a birds-eye view of the current Drupal installation, if any. |
| script | Run php script(s). |
| cache clear (cc) | Clear all caches. |
| watchdog show (ws) | Shows recent watchdog log messages. Optionally filter for a specific type. |
| watchdog delete (wd) | Delete all messages or only those of a specified type. |
| sync | Rsync the Drupal tree to/from another server using ssh. |
| eval | Evaluate arbitrary php code after bootstrapping Drupal. |
| enable (en) | Enable one or more modules. |
| disable (dis) | Disable one or more modules. |
| pm-uninstall | Uninstall one or more modules. |
| statusmodules (sm) | Show module enabled/disabled status |
| refresh (rf) | Refresh update status information |
| updatecode (upc) | Update your project code |
| update (up) | Update your project code and apply any database updates required (update.php) |
| info | Release information for a project |
| dl | Download core Drupal and projects like CCK, Zen, etc. |
| test mail | Run all tests and mail the results to your team. |
| test clean | Delete leftover tables and files from prior test runs. |
| sql-conf | Print database connection details. |
| sql-connect | A string for connecting to the DB. |
| sql-dump | Exports the Drupal DB as SQL using mysqldump. |
| sql-query (sqlq) | Execute a query against the site database. |
| sql-load | Copy source database to target database. |
| sql-cli (sqlc) | Open a SQL command-line interface using Drupal’s credentials. |
| vget %var | List of all variable names beginning with %var and their values. |
| vset %var %val | Set all variables beginning with %var and set to %val. |
Plug-in commands (provided by modules)
Delete all
delete-all article Delete all article nodes.
delete-all all Delete nodes of all types.
delete-all --reset Delete nodes of all types, and reset node, revision and comment counters.
delete-all users Delete users.
Devel
devel-download Downloads the FirePHP library from http://firephp.org/.
devel-reinstall Disable, Uninstall, and Install a list of projects.
fn-hook List implementations of a given hook and explore the source of the selected one.
fn-view Show the source of specified function or method.
devel-token List available tokens
Devel Generate
generate-users Create users.
generate-taxonomy Create taxonomy.
generate-vocabs Create vocabularies.
generate-terms Create terms in specified vocabulary.
generate-content Create content.
generate-menu Create menus and menu items.
Module Builder
mb Generate the code for a new Drupal module, including file headers and hook implementations.
mbdl Update module_builder hook data.
mb-list List the hooks module_builder knows about.
mb-dochooks Adds comment headers to hooks that need them in the given module.
mb-docparams Adds params... WIP!
mb-debug Debug module builder. Does whatever was needed at the time.
Drush Make
make Makes a drupal site out of a makefile.
Backup and Migrate
bam-backup Backup the site's database with Backup and Migrate.
bam-restore Restore the site's database with Backup and Migrate.
bam-destinations Get a list of available destinations.
bam-sources Get a list of available sources.
bam-profiles Get a list of available settings profiles.
bam-backups Get a list of previously created backup files.
Feed API
feedapi create Creates a feed
feedapi refresh Refreshes a feed
feedapi parse Parses a feed and outputs the result to the stdout
feedapi config Shows the config of a given parser or processor
feedapi refresh Refreshes a feed
Statistics Pro
statspro aliases Presents the aliase count for today.
statspro comments Presents the created comment count for today.
statspro error Presents the errors count for today.
statspro modules Presents the installed module count for today.
statspro nodes Presents the created node count for today.
statspro node_types Presents the existent node type count for today.
statspro pi Presents the page impression count for today.
statspro sessions Presents the sessions count for today.
statspro terms Presents the taxonomy term count for today.
statspro uerror Presents the error presented to authenticated users count for today.
statspro upi Presents the page impression for authenticated users count for today.
statspro users Presents the created user count for today.
statspro uwarning Presents the wrning presented to authenticated user count for today.
statspro warning Presents the warning count for today.
Zenophile
zenophile Creates Zen subthemes quickly and easily.
zen Alias for the "zenophile" command.
Omega Tools
omega-subtheme "New Theme Name" Creates an HTML5 subtheme (new_theme_name) in the default sites/all/themes
omega-subtheme "New Theme Name" html5 Creates an HTML5 subtheme (new_theme_name) in the default sites/all/themes
omega-subtheme "New Theme Name" xhtml Creates an XHTML subtheme (new_theme_name) in the default sites/all/themes
omega-subtheme "New Theme Name" --destination=example.com Creates an HTML5 subtheme (new_theme_name) in the default sites/example.com/themes
Node Export
ne-export Export nodes using Node export.
ne-import Import nodes previously exported with Node export.
node-export Export nodes using Node export.
node-export-export Export nodes using Node export.
node-export-import Import nodes previously exported with Node export.
Arguments:
nids : A list of space-separated node IDs to export.
Options:
--file : The filename of the output file. If supplied, the node code will be exported to that file (exported to drupal root), otherwise it will export to stdout.
--format : If supplied, node code will be output using a particular export format, if available. (e.g. serialize)
--status : Filter for 'status'; A boolean value (0 or 1) indicating whether the node is published (visible to non-administrators).
--promote : Filter for 'promote'; A boolean value (0 or 1) indicating whether the node should be displayed on the front page.
--sticky : Filter for 'sticky'; A boolean value (0 or 1) indicating whether the node should be displayed at the top of lists in which it appears.
--translate : Filter for 'translate'; A boolean value (0 or 1) indicating whether the node translation needs to be updated.
--language : Filter for 'language'; The language code (e.g. de or en-US) of this node.
--type : Filter for 'type'; The machine-readable name (e.g. story or page) of the type of this node.
--sql : Filter by SQL (EXPERIMENTAL); An SQL query string that returns nids (e.g. "SELECT nid FROM nodes WHERE nid < 10").
--code : Filter by PHP code (EXPERIMENTAL); PHP code that prints or returns, an array or CSV string of nids (e.g. "custom_get_my_nids();"). Don't include PHP tags.