- cache-clear
Clear a specific cache, or all drupal caches.
Arguments:
type The particular cache to clear. Omit
this argument to choose from
available caches.
Aliases: cc
- core-cli
Enter a new shell optimized for drush use. All .bashrc customizations are still
available.
Examples:
help Print available drush commands
cd @alias Navigate to the root of the site
indicated by @alias; subsequent
commands will target that site.
cd %files Navigate to the files directory.
cd ~ Navigate back to your $HOME
directory.
lsd files List all files in the Drupal files
directory.
on @alias core-status Run the command "core-status" on the
site indicated by @alias
@alias core-status An even shorter form that also runs
"core-status" on the site @alias
use @alias Run subsequent commands on the site
indicated by @alias
use - Switch back to the last alias
"used".
use ~ Use the default alias.
use Revert to an ordinary prompt; do not
use an alias.
drush core-cli --pipe > ~/.bash_aliases Convert your default shell into
drush core-cli. Make sure that your
.bashrc file includes .bash_aliases
(e.g. "source ~/.bash_aliases" or ".
~/.bash_aliases").
Options:
--override List of drush commands or aliases
that should override built-in shell
functions and commands; otherwise,
built-ins override drush commands.
Defaults to dd,help,sa.
--contextual Additional drush overrides that
function ONLY when the prompt is
"@alias>". Defaults to
cc,cron,rsync,status,sync,updatedb.
--ignore Drush commands or aliases that
should not be usable from core-cli.
Takes precedence over override and
contextual options. Defaults to
core-cli,cli.
--pipe Print the generated .bashrc file and
exit.
Aliases: cli
- core-cron
Run all cron hooks in all active modules for specified site.
Aliases: cron
- core-rsync
Rsync the Drupal tree to/from another server using ssh.
Examples:
drush rsync @dev @stage Rsync Drupal root from dev to stage
(one of which must be local).
drush rsync ./ @stage:%files/img Rsync all files in the current
directory to the 'img' directory in
the file storage folder on stage.
Arguments:
source May be rsync path or site alias. See
rsync documentation and
example.aliases.drushrc.php.
destination May be rsync path or site alias. See
rsync documentation and
example.aliases.drushrc.php.
Options:
--mode The unary flags to pass to rsync;
--mode=rultz implies rsync -rultz.
Default is -az.
--RSYNC-FLAG Most rsync flags passed to drush
sync will be passed on to rsync.
See rsync documentation.
--exclude-conf Excludes settings.php from being
rsynced. Default.
--include-conf Allow settings.php to be rsynced
--exclude-files Exclude the files directory.
--exclude-sites Exclude all directories in "sites/"
except for "sites/all".
--exclude-other-sites Exclude all directories in "sites/"
except for "sites/all" and the site
directory for the site being synced.
Note: if the site directory is
different between the source and
destination, use --exclude-sites
followed by "drush rsync @from:%site
@to:%site"
--exclude-paths List of paths to exclude, seperated
by : (Unix-based systems) or ;
(Windows).
--include-paths List of paths to include, seperated
by : (Unix-based systems) or ;
(Windows).
Topics:
docs-aliases Site aliases overview with examples
Aliases: rsync
- core-status
Provides a birds-eye view of the current Drupal installation, if any.
Examples:
drush status version Show all status lines that contain
version information.
drush status --pipe A list key=value items separated by
line breaks.
drush status drush-version --pipe Emit just the drush version with no
label.
Arguments:
item Optional. The status item line(s)
to display.
Options:
--show-passwords Show database password.
Topics:
docs-readme README.txt
Aliases: status, st
- core-topic
Read detailed documentation on a given topic.
Examples:
drush topic Show all available topics.
drush topic docs-context Show documentation for the drush
context API
drush docs-context Show documentation for the drush
context API
Arguments:
topic name The name of the topic you wish to
view. If omitted, list all topic
descriptions (and names in
parenthesis).
Topics:
docs-readme README.txt
Aliases: topic
- drupal-directory
Return the filesystem path for modules/themes and other key folders. Used by
`cli` command for handy commands `cdd` and `lsd`. If you want to use this
command directly, you usually want to prefix the command with cd and enclose the
command invocation in backticks. See Examples below.
Examples:
cd `drush dd devel` Navigate into the devel module
directory
cd `drush dd` Navigate to the root of your Drupal
site
cd `drush dd files` Navigate to the files directory.
drush dd @alias:%files Print the path to the files
directory on the site @alias.
edit `drush dd devel`/devel.module Open devel module in your editor
(customize 'edit' for your editor)
Arguments:
target A module/theme name, or special
names like root, files, private, or
an alias : path alias string such as
@alias:%files. Defaults to root.
Options:
--component The portion of the evaluated path to
return. Defaults to 'path'; 'name'
returns the site alias of the
target.
--local Reject any target that specifies a
remote site.
Aliases: dd
- help
Drush provides an extensive help system that describes both drush commands and
topics of general interest. Use `drush help --filter` to present a list of
command categories to view, and `drush topic` for a list of topics that go more
in-depth on how to use and extend drush.
Examples:
drush List all commands.
drush --filter=devel_generate Show only commands defined in
devel_generate.drush.inc
drush help pm-download Show help for one command.
drush help dl Show help for one command using an
alias.
Options:
--sort Sort commands in alphabetical order.
drush waits for full bootstrap
before printing any commands when
this option is used.
--filter Restrict command list to those
commands defined in the specified
file.
--html Print help for all commands in HTML
format.
--pipe A list of available commands, one
per line.
Topics:
docs-readme README.txt
- image-flush
Flush all derived images for a given style.
Examples:
drush image-flush Pick an image style and then delete
its images.
drush image-flush thumbnail Delete all thumbnail images.
drush image-flush --all Flush all derived images. They will
be regenerated on the fly.
Arguments:
style An image style machine name. If not
provided, user may choose from a
list of names.
Options:
--all Flush all derived images
- php-eval
Evaluate arbitrary php code after bootstrapping Drupal (if available).
Examples:
drush php-eval "variable_set('hello', Sets the hello variable using Drupal
'world');" API.
Arguments:
code PHP code
Aliases: eval, ev
- php-script
Runs the given php script(s) after a full Drupal bootstrap. A useful alternative
to eval command when your php is lengthy or you can't be bothered to figure out
bash quoting. If you plan to share a script with others, consider making a full
drush command instead, since that's more self-documenting. Drush provides
commandline options to the script via drush_get_option('option-name'), and
commandline arguments can be accessed either via drush_get_arguments(), which
returns all arguments in an array, or drush_shift(), which removes the next
argument from the list and returns it.
Examples:
drush php-script scratch Run scratch.php script. See
commands/core directory.
drush php-script example Run script from specified paths
--script-path=/path/to/scripts:/another/
path
drush php-script List all available scripts.
#!/usr/bin/env drush Execute php code with a full Drupal
- search-index
Index the remaining search items without wiping the index.
- search-reindex
Force the search index to be rebuilt.
Options:
--immediate Rebuild the index immediately,
instead of waiting for cron.
- search-status
Show how many items remain to be indexed out of the total.
Options:
--pipe Display in the format
remaining/total for processing by
scripts.
- self-update
Update drush to the latest version, if available.
Options:
--dev Allow updates to latest dev release.
Aliases: selfupdate
- site-alias
Print an alias record.
Examples:
drush site-alias List all alias records known to
drush.
drush site-alias @dev Print an alias record for the alias
'dev'.
Arguments:
site Site specification alias to print
Options:
--full Print the full alias record for each
site. Default when aliases are
specified on the command line.
--component Print only the specified element
from the full alias record.
--short Print only the site alias name.
Default when not command line
arguments are specified.
--pipe Print the long-form site
specification for each site.
--with-db Include the databases structure in
the full alias record.
--with-db-url Include the short-form db-url in the
full alias record.
--no-db Do not include the database record
in the full alias record (default).
--with-optional Include optional default items.
Topics:
docs-aliases Site aliases overview with examples
Aliases: sa
- site-install
Install Drupal along with modules/themes/configuration using the specified
install profile.
Examples:
drush site-install expert --locale=uk (Re)install using the expert install
profile. Set default language to
Ukranian.
drush site-install Install using the specified DB
--db-url=mysql://root:pass@localhost:por params.
t/dbname
drush site-install Install using SQLite (D7 only).
--db-url=sqlite:/full/path/to/database.s
qlite
drush site-install --account-name=joe Re-install with specified uid1
--account-pass=mom credentials.
Arguments:
profile the install profile you wish to run.
defaults to 'default'
Options:
--db-url A Drupal 5/6 style database URL.
Only required for initial install -
not re-install.
--db-prefix An optional table prefix to use for
initial install.
--account-name uid1 name. defaults to admin
--account-pass uid1 pass. defaults to admin
--account-mail uid1 email. defaults to
admin@example.com
--locale A short language code. Sets the
default site language. Language
files must already be present. You
may use download command to get
them.
--clean-url Defaults to 1
--site-name Defaults to Site-Install
--site-mail From: for system mailings. Defaults
to admin@example.com
--sites-subdir Name of directory under 'sites'
which should be created. Only needed
when the subdirectory does not
already exist. Defaults to 'default'
Aliases: si
- site-upgrade
Execute a major version upgrade for Drupal core and enabled contrib modules.
Command will download next version of Drupal and all available contrib modules
that have releases (if not already downloaded). It prepares a settings.php for
the target site, and copies the prior version's database to the target site.
Finally, updatedb is run. The intent is for developers to keep re-running this
command until they are satisfied with the resulting site. Run this command from
within your source site (D6). Note that this command uses pm-download and
sql-sync internally so most options for those commands are valid here too.
Examples:
drush site-upgrade @onward Upgrade from the current site to the
site specified by @onward alias.
Arguments:
target The name of a sitealias, which
points to the destination site.
root, uri, and db-url keys are
required. See
examples/aliases.drushrc.php for
more information about creating a
site alias.
Options:
--structure-tables-key A key in the structure-tables array.
@see example.drushrc.php. Defaults
to 'common'.
--source-dump Path to dump file. Medium or large
sized sites should set this.
Optional; default is to create a
temporary file.
--db-su DB username to use when dropping and
creating the target database.
Optional.
--db-su-pw DB password to use when dropping and
creating the target database.
Optional.
--no-cache Transfer a fresh database from
source site. Otherwise, DB dump is
re-used for 24 hours.
--no-updatedb Don't updatedb on the target site.
Can be useful while debugging to run
this separately.
Topics:
docs-aliases Site aliases overview with examples
Aliases: sup
- test-clean
Clean temporary tables and files.
- test-run
Run tests. Note that you must use the --uri option.
Examples:
test-run List all available classes and
groups.
sudo -u apache test-run --all Run all available tests. Avoid
permission related failures by
running as web server user.
test-run XMLRPCBasicTestCase Run one test class.
test-run XML-RPC Run all classes in a XML-RPC group.
test-run XML-RPC,Filter Run all tests from multiple
groups/classes.
test-run XMLRPCBasicTestCase Run particular methods in the
--methods="testListMethods, specified class or group.
testInvalidMessageParsing"
Arguments:
targets A test class, a test group. If
omitted, a list of test classes and
test groups is presented. Delimit
multiple targets using commas.
Options:
--all Run all available tests
--methods A comma delimited list of methods
that should be run within the test
class. Defaults to all methods.
--dirty Skip cleanup of temporary tables and
files. Helpful for reading debug()
messages and other post-mortem
forensics.
- updatedb
Apply any database updates required (as with running update.php).
Aliases: updb
- variable-delete
Delete a variable.
Examples:
drush vdel user_pictures Delete the user_pictures variable.
drush vdel u Choose from a list of variables
beginning with "u" to delete.
Arguments:
name The name of a variable or the first
few letters of its name.
Options:
--yes Skip confirmation if only one
variable name matches.
Aliases: vdel
- variable-get
Lists the variables for your site
Examples:
drush vget List all variables and values.
drush vget user List all variables beginning with
the string "user".
Arguments:
name A string to filter the variables by.
Only variables beginning with the
string will be listed.
Options:
--pipe Use var_export() to emit executable
PHP. Useful for pasting into code.
Aliases: vget
- variable-set
Set a variable
Examples:
drush vset --yes preprocess_css 1 Set the preprocess_css variable to
true. Skip confirmation if variable
already exists.
drush vset --always-set site_offline 1 Take the site offline; Skips
confirmation even if site_offline
variable does not exist.
drush vset pr 1 Choose from a list of variables
beginning with "pr" to set to true.
Arguments:
name The name of a variable or the first
few letters of its name.
value The value to assign to the variable.
Options:
--yes Skip confirmation if only one
variable name matches.
--always-set Always skip confirmation.
Aliases: vset
- version
Show drush version.
Options:
--pipe Print just the version number, and
nothing else.
- watchdog-delete
Delete watchdog messages. Arguments or options must be provided to specify which
messages to delete.
Examples:
drush watchdog-delete all Delete all messages.
drush watchdog-delete 64 Delete messages with id 64.
drush watchdog-delete "cron run Delete messages containing the
succesful" string "cron run succesful".
drush watchdog-delete --severity=notice Delete all messages with a severity
of notice.
drush watchdog-delete --type=cron Delete all messages of type cron.
Arguments:
severity Delete messages of a given severity
level.
type Delete messages of a given type.
Aliases: wd-del, wd-delete
- watchdog-list
Show available message types and severity levels. A prompt will ask for a choice
to show watchdog messages.
Aliases: wd-list
- watchdog-show
Show watchdog messages. Arguments and options can be combined to configure which
messages to show.
Examples:
drush watchdog-show Show a listing of most recent 10
messages.
drush watchdog-show 64 Show in detail message with id 64.
drush watchdog-show "cron run succesful" Show a listing of most recent 10
messages containing the string "cron
run succesful".
drush watchdog-show --count=46 Show a listing of most recent 46
messages.
drush watchdog-show --severity=notice Show a listing of most recent 10
messages with a severity of notice.
drush watchdog-show --type=php Show a listing of most recent 10
messages of type php.
drush watchdog-show --tail Show a listing of most recent 10
messages and continue showing
messages as they are registered in
the watchdog.
drush watchdog-show --tail Do a tail of the watchdog with a
--sleep-delay=2 delay of two seconds between each
poll to the database.
Arguments:
wid Optional id of a watchdog message to
show in detail. If not provided, a
listing of most recent 10 messages
will be displayed. Alternatively if
a string is provided, watchdog
messages will be filtered by it.
Options:
--count The number of messages to show.
Defaults to 10.
--severity Restrict to messages of a given
severity level.
--type Restrict to messages of a given
type.
--tail Continuously show new watchdog
messages until interrupted.
--sleep-delay To be used in conjunction with
--tail. This is the number of
seconds to wait between each poll to
the database. Delay is 1 second by
default.
Aliases: wd-show, ws
- field-clone
Clone a field and all its instances.
Examples:
field-clone tags labels Copy 'tags' field into a new field
'labels' field which has same
instances.
open `field-clone tags labels` Clone field and then open field edit
forms for refinement.
Arguments:
source_field_name Name of field that will be cloned
target_field_name Name of new, cloned field.
- field-create
Create fields and instances. Returns urls for field editing.
Examples:
drush field-create article Define new article fields via
interactive prompts.
open `drush field-create article` Define new article fields and then
open field edit form for refinement.
drush field-create article Create two new fields.
city,text,text_textfield
subtitle,text,text_textfield
Arguments:
bundle Content type (for nodes). Name of
bundle to attach fields to.
Required.
field_spec Comma delimited triple in the form:
field_name,field_type,widget_name.
If widget_name is omitted, the
default widget will be used.
Separate multiple fields by space.
If omitted, a wizard will prompt
you.
Options:
--entity_type Type of entity (e.g. node, user,
comment). Defaults to node.
- field-delete
Delete a field and its instances.
Examples:
field-delete city Delete the city field and any
instances it might have.
field-delete city --bundle=article Delete the city instance on the
article bundle
Arguments:
field_name Name of field to delete.
Options:
--bundle Only delete the instance attached to
this bundle. If omitted, admin can
choose to delete one instance or
whole field.
--entity_type Disambiguate a particular bundle
from identically named bundles.
Usually not needed.
- field-info
View information about fields, field_types, and widgets.
Examples:
field-info types Show a table which lists all field
types and their available widgets
Arguments:
type Recognized values: fields, types. If
omitted, a choice list appears.
- field-update
Return URL for field editing web page.
Examples:
field-update comment_body Quickly navigate to a field edit web
page.
Arguments:
field_name Name of field that needs updating.
- pm-disable
Disable one or more extensions (modules or themes). Disable dependant extensions
as well.
Arguments:
extensions A list of modules or themes. You can
use the * wildcard at the end of
extension names to disable multiple
matches.
Aliases: dis
- pm-download
Download Drupal core or projects from drupal.org (Drupal core, modules, themes
or profiles) and other sources. It will automatically figure out which project
version you want based on its recommended release, or you may specify a
particular version.
If no --destination is provided, then destination depends on the project type:
- Profiles will be downloaded to profiles/ in your Drupal root.
- Modules and themes will be downloaded to the site specific directory
(sites/example.com/modules|themes) if available, or to sites/all/modules|themes.
- If you're downloading drupal core or you are not running the command within
a bootstrapped drupal site, the default location is the current directory.
- Drush commands will be relocated to /usr/share/drush/commands (if
available) or ~/.drush. Relocation is determined once the project is downloaded
by examining its content. Note you can provide your own function in a
commandfile to determine the relocation of any project.
Examples:
drush dl Download latest recommended release
of Drupal core.
drush dl drupal Same as `drush dl`.
drush dl drupal-7.x Download latest 7.x development
version of Drupal core.
drush dl cck zen Download latest versions of CCK and
Zen projects.
drush dl og-1.3 Download a specfic version of
Organic groups module for my version
of Drupal.
drush dl diff-6.x-2.x Download a specific development
branch of diff module for a specific
Drupal version.
drush dl views --select Show a list of recent releases of
the views project, prompt for which
one to download.
drush dl webform --dev Download the latest dev release of
webform.
drush dl cck --version-control=bzr Download the cck project and then
--bzrsync --bzrcommit add it and commit it to Bazaar.
drush pm-download cck Commit changes as the user 'joe'
--svncommitparams=\"--username joe\" (Quotes are required).
drush pm-download cck Checkout should use these
--cvscredentials=\"name:password\" credentials.
drush pm-download cck --cvsparams=\"-C\" Overwrite all local changes (Quotes
are required).
drush pm-download cck --cvsmethod=update Will update the project, and try to
merge changes, rather than
overwriting them. Any conflicts will
need to be resolved manually.
Arguments:
projects A list of drpal.org project names,
with optional version. Defaults to
'drupal'
Options:
--destination Path to which the project will be
copied. If you're providing a
relative path, note it is relative
to the drupal root (if
bootstrapped).
--use-site-dir Force to use the site specific
directory. It will create the
directory if it doesn't exist. If
--destination is also present this
option will be ignored.
--source The base URL which provides project
release history in XML. Defaults to
http://updates.drupal.org/release-hi
story.
--notes Show release notes after each
project is downloaded.
--variant Only useful for install profiles.
Possible values: 'full', 'projects',
'profile-only'.
--dev Download a development release.
--select Select the version to download
interactively from a list of
available releases.
--all Useful only with --select; shows all
available releases instead of a
short list of recent releases.
--drupal-project-rename Alternate name for "drupal-x.y"
directory when downloading Drupal
project. Defaults to "drupal".
--pipe Returns a list of the names of the
extensions (modules and themes)
contained in the downloaded
projects.
--version-control=backup Default engine. Backup all project
files before updates.
--no-backup Do not perform backups.
--backup-dir Specify a directory to backup
projects into. Defaults to
drush-backups within the home
directory of the user running the
command. It is forbidden to specify
a directory inside your drupal root.
--version-control=bzr Quickly add/remove/commit your
project changes to Bazaar.
--bzrsync Automatically add new files to the
Bazaar repository and remove deleted
files. Caution.
--bzrcommit Automatically commit changes to
Bazaar repository. You must also usw
the --bzrsync option.
--bzrmessage Override default commit message
which is: Drush automatic commit.
Project Command:
--version-control=svn Quickly add/remove/commit your
project changes to Subversion.
--svnsync Automatically add new files to the
SVN repository and remove deleted
files. Caution.
--svncommit Automatically commit changes to SVN
repository. You must also using the
--svnsync option.
--svnmessage Override default commit message
which is: Drush automatic commit:
--svnstatusparams Add options to the 'svn status'
command
--svnaddparams Add options to the `svn add` command
--svnremoveparams Add options to the `svn remove`
command
--svnrevertparams Add options to the `svn revert`
command
--svncommitparams Add options to the `svn commit`
command
--package-handler=cvs Use CVS to checkout and update
projects.
--cvsparams Add options to the `cvs` program
--cvsmethod Force cvs updates or checkouts
(checkout is default unless the
directory is managed by a supported
version control system).
--cvscredentials A username and password that is sent
for cvs checkout command. Defaults
to anonymous:anonymous
--package-handler=git_drupalorg Use git.drupal.org to checkout and
update projects.
--gitsubmodule Use git submodules for checking out
new projects. Existing git checkouts
are unaffected, and will continue to
(not) use submodules regardless of
this setting.
--gitcheckoutparams Add options to the `git checkout`
command.
--gitcloneparams Add options to the `git clone`
command.
--gitfetchparams Add options to the `git fetch`
command.
--gitpullparams Add options to the `git pull`
command.
--gitsubmoduleaddparams Add options to the `git submodule
add` command.
Aliases: dl
- pm-enable
Enable one or more extensions (modules or themes). Enable dependant extensions
as well.
Arguments:
extensions A list of modules or themes. You can
use the * wildcard at the end of
extension names to enable all
matches.
Aliases: en
- pm-info
Show detailed info for one or more extensions (modules or themes).
Arguments:
extensions A list of modules or themes. You can
use the * wildcard at the end of
extension names to show info for
multiple matches. If no argument is
provided it will show info for all
available extensions.
Aliases: pmi
- pm-list
Show a list of available extensions (modules and themes).
Options:
--type Filter by extension type. Choices:
module, theme.
--status Filter by extension status. Choices:
enabled, disable and/or 'not
installed'. You can use multiple
comma separated values. (i.e.
--status="disabled,not installed").
--package Filter by project packages. You can
use multiple comma separated values.
(i.e. --package="Core -
required,Other").
--core Filter out extensions that are not
in drupal core.
--no-core Filter out extensions that are
provided by drupal core.
--pipe Returns a space delimited list of
the names of the resulting
extensions.
Aliases: pml
- pm-refresh
Refresh update status information.
Aliases: rf
- pm-releasenotes
Print release notes for given projects.
Examples:
drush rln cck Prints the release notes for the
recommended version of CCK project.
drush rln token-1.13 View release notes of a specfic
version of the Token project for my
version of Drupal.
drush rln pathauto zen View release notes for the
recommended version of Pathauto and
Zen projects.
Arguments:
projects A list of drupal.org project names,
with optional version. Defaults to
'drupal'
Options:
--html Display releasenotes in HTML rather
than plain text.
Aliases: rln
- pm-releases
View all releases for a given drupal.org project. Useful for deciding which
version to install/update.
Examples:
drush pm-releases cck zen View releases for cck and Zen
projects for your Drupal version.
Arguments:
projects A list of drupal.org project names.
Defaults to 'drupal'
Options:
--dev Show only development releases.
--all Shows all available releases instead
of the default short list of recent
releases.
Aliases: rl
- pm-uninstall
Uninstall one or more modules.
Arguments:
modules A list of modules.
- pm-update
Display available update information for Drupal core and all enabled projects
and allow updating to latest recommended releases. Also apply any database
updates required (same as pm-updatecode + updatedb). Note: The user is asked to
confirm before the actual update. Backups are performed unless directory is
already under version control. Updated projects can potentially break your site.
It is NOT recommended to update production sites without prior testing.
Examples:
drush dl cck --version-control=bzr Download the cck project and then
--bzrsync --bzrcommit add it and commit it to Bazaar.
drush pm-update cck Commit changes as the user 'joe'
--svncommitparams=\"--username joe\" (Quotes are required).
drush pm-update cck Checkout should use these
--cvscredentials=\"name:password\" credentials.
drush pm-update cck --cvsparams=\"-C\" Overwrite all local changes (Quotes
are required).
drush pm-update cck --cvsmethod=update Will update the project, and try to
merge changes, rather than
overwriting them. Any conflicts will
need to be resolved manually.
Arguments:
projects Optional. A list of installed
projects to update.
Options:
--pipe Returns a space delimited list of
projects with any of its extensions
enabled and their respective version
and update information, one project
per line. Order: project name,
current version, recommended
version, update status.
--notes Show release notes for each project
to be updated.
--security-only Only update modules that have
security updates available. However,
if there were other releases of a
module between the installed version
the security update, other changes
to features or functionality may
occur.
--lock Add a persistent lock to remove the
specified projects from
consideration during updates. Locks
may be removed with the --unlock
parameter, or overridden by
specifically naming the project as a
parameter to pm-update or
pm-updatecode. The lock does not
affect pm-download. See also the
update-advanced project for similar
and improved functionality.
--lock-message A brief message explaining why a
project is being locked; displayed
during pm-updatecode. Optional.
--unlock Remove the persistent lock from the
specified projects so that they may
be updated again.
--version-control=backup Default engine. Backup all project
files before updates.
--no-backup Do not perform backups.
--backup-dir Specify a directory to backup
projects into. Defaults to
drush-backups within the home
directory of the user running the
command. It is forbidden to specify
a directory inside your drupal root.
--version-control=bzr Quickly add/remove/commit your
project changes to Bazaar.
--bzrsync Automatically add new files to the
Bazaar repository and remove deleted
files. Caution.
--bzrcommit Automatically commit changes to
Bazaar repository. You must also usw
the --bzrsync option.
--bzrmessage Override default commit message
which is: Drush automatic commit.
Project Command:
--version-control=svn Quickly add/remove/commit your
project changes to Subversion.
--svnsync Automatically add new files to the
SVN repository and remove deleted
files. Caution.
--svncommit Automatically commit changes to SVN
repository. You must also using the
--svnsync option.
--svnmessage Override default commit message
which is: Drush automatic commit:
--svnstatusparams Add options to the 'svn status'
command
--svnaddparams Add options to the `svn add` command
--svnremoveparams Add options to the `svn remove`
command
--svnrevertparams Add options to the `svn revert`
command
--svncommitparams Add options to the `svn commit`
command
--package-handler=cvs Use CVS to checkout and update
projects.
--cvsparams Add options to the `cvs` program
--cvsmethod Force cvs updates or checkouts
(checkout is default unless the
directory is managed by a supported
version control system).
--cvscredentials A username and password that is sent
for cvs checkout command. Defaults
to anonymous:anonymous
--package-handler=git_drupalorg Use git.drupal.org to checkout and
update projects.
--gitsubmodule Use git submodules for checking out
new projects. Existing git checkouts
are unaffected, and will continue to
(not) use submodules regardless of
this setting.
--gitcheckoutparams Add options to the `git checkout`
command.
--gitcloneparams Add options to the `git clone`
command.
--gitfetchparams Add options to the `git fetch`
command.
--gitpullparams Add options to the `git pull`
command.
--gitsubmoduleaddparams Add options to the `git submodule
add` command.
Topics:
docs-policy Example policy file
Aliases: up
- pm-updatecode
Display available update information for Drupal core and all enabled projects
and allow updating to latest recommended releases. Note: The user is asked to
confirm before the actual update. Backups are performed unless directory is
already under version control. Updated projects can potentially break your site.
It is NOT recommended to update production sites without prior testing.
Examples:
drush dl cck --version-control=bzr Download the cck project and then
--bzrsync --bzrcommit add it and commit it to Bazaar.
drush pm-updatecode cck Commit changes as the user 'joe'
--svncommitparams=\"--username joe\" (Quotes are required).
drush pm-updatecode cck Checkout should use these
--cvscredentials=\"name:password\" credentials.
drush pm-updatecode cck Overwrite all local changes (Quotes
--cvsparams=\"-C\" are required).
drush pm-updatecode cck Will update the project, and try to
--cvsmethod=update merge changes, rather than
overwriting them. Any conflicts will
need to be resolved manually.
Arguments:
projects Optional. A list of installed
projects to update.
Options:
--pipe Returns a space delimited list of
projects with any of its extensions
enabled and their respective version
and update information, one project
per line. Order: project name,
current version, recommended
version, update status.
--notes Show release notes for each project
to be updated.
--security-only Only update modules that have
security updates available. However,
if there were other releases of a
module between the installed version
the security update, other changes
to features or functionality may
occur.
--lock Add a persistent lock to remove the
specified projects from
consideration during updates. Locks
may be removed with the --unlock
parameter, or overridden by
specifically naming the project as a
parameter to pm-update or
pm-updatecode. The lock does not
affect pm-download. See also the
update-advanced project for similar
and improved functionality.
--lock-message A brief message explaining why a
project is being locked; displayed
during pm-updatecode. Optional.
--unlock Remove the persistent lock from the
specified projects so that they may
be updated again.
--version-control=backup Default engine. Backup all project
files before updates.
--no-backup Do not perform backups.
--backup-dir Specify a directory to backup
projects into. Defaults to
drush-backups within the home
directory of the user running the
command. It is forbidden to specify
a directory inside your drupal root.
--version-control=bzr Quickly add/remove/commit your
project changes to Bazaar.
--bzrsync Automatically add new files to the
Bazaar repository and remove deleted
files. Caution.
--bzrcommit Automatically commit changes to
Bazaar repository. You must also usw
the --bzrsync option.
--bzrmessage Override default commit message
which is: Drush automatic commit.
Project Command:
--version-control=svn Quickly add/remove/commit your
project changes to Subversion.
--svnsync Automatically add new files to the
SVN repository and remove deleted
files. Caution.
--svncommit Automatically commit changes to SVN
repository. You must also using the
--svnsync option.
--svnmessage Override default commit message
which is: Drush automatic commit:
--svnstatusparams Add options to the 'svn status'
command
--svnaddparams Add options to the `svn add` command
--svnremoveparams Add options to the `svn remove`
command
--svnrevertparams Add options to the `svn revert`
command
--svncommitparams Add options to the `svn commit`
command
--package-handler=cvs Use CVS to checkout and update
projects.
--cvsparams Add options to the `cvs` program
--cvsmethod Force cvs updates or checkouts
(checkout is default unless the
directory is managed by a supported
version control system).
--cvscredentials A username and password that is sent
for cvs checkout command. Defaults
to anonymous:anonymous
--package-handler=git_drupalorg Use git.drupal.org to checkout and
update projects.
--gitsubmodule Use git submodules for checking out
new projects. Existing git checkouts
are unaffected, and will continue to
(not) use submodules regardless of
this setting.
--gitcheckoutparams Add options to the `git checkout`
command.
--gitcloneparams Add options to the `git clone`
command.
--gitfetchparams Add options to the `git fetch`
command.
--gitpullparams Add options to the `git pull`
command.
--gitsubmoduleaddparams Add options to the `git submodule
add` command.
Topics:
docs-policy Example policy file
Aliases: upc
- sql-cli
Open a SQL command-line interface using Drupal's credentials.
Options:
--database The DB connection key if using
multiple connections in
settings.php.
Aliases: sqlc
- sql-connect
A string for connecting to the DB.
Examples:
`drush sql-connect` < example.sql Import sql statements from a file
into the current database.
Options:
--database The DB connection key if using
multiple connections in
settings.php.
- sql-drop
Drop all tables in a given database.
Options:
--yes Skip confirmation and proceed.
--result-file Save to a file. The file should be
relative to Drupal root.
Recommended.
--database The DB connection key if using
multiple connections in
settings.php.
Topics:
docs-policy Example policy file
- sql-dump
Exports the Drupal DB as SQL using mysqldump or equivalent.
Examples:
drush sql-dump --result-file=../18.sql Save SQL dump to the directory above
Drupal root.
drush sql-dump --skip-tables-key=common Skip standard tables. @see
example.drushrc.com
Options:
--result-file Save to a file. The file should be
relative to Drupal root. If
--result-file is provided with no
value, then date based filename will
be created under ~/drush-backups
directory.
--skip-tables-key A key in the $skip_tables array.
@see example.drushrc.php. Optional.
--structure-tables-key A key in the $structure_tables
array. @see example.drushrc.php.
Optional.
--tables-key A key in the $tables array.
Optional.
--tables-list A comma-separated list of tables to
transfer. Optional.
--ordered-dump Order by primary key and add line
breaks for efficient diff in
revision control. Also, faster
rsync. Slows down the dump. Mysql
only.
--create-db Wipe existing tables.
--data-only Omit CREATE TABLE statements.
Postgres only.
--gzip Compress the dump using the gzip
program which must be in your $PATH.
--database The DB connection key if using
multiple connections in
settings.php.
- sql-query
Execute a query against the site database.
Examples:
drush sql-query "SELECT * FROM {users} Browse user record. Table prefixes
WHERE uid=1" are honored.
`drush sql-connect` < example.sql Import sql statements from a file
into the current database.
Arguments:
query An SQL query.
Options:
--extra Add custom options to the mysql
command.
--database The DB connection key if using
multiple connections in
settings.php.
Aliases: sqlq
- sql-sync
Copy and import source database to target database. Transfers via rsync.
Examples:
drush sql-sync @dev @prod Copy the DB defined in sites/dev to
the DB in sites/prod.
Arguments:
from Name of subdirectory within /sites
or a site-alias.
to Name of subdirectory within /sites
or a site-alias.
Options:
--skip-tables-key A key in the $skip_tables array.
@see example.drushrc.php. Optional.
--structure-tables-key A key in the $structure_tables
array. @see example.drushrc.php.
Optional.
--tables-key A key in the $tables array.
Optional.
--tables-list A comma-separated list of tables to
transfer. Optional.
--cache Skip dump if result file exists and
is less than "cache" hours old.
Optional; default is 24 hours.
--no-cache Do not cache the sql-dump file.
--no-dump Do not dump the sql database; always
use an existing dump file.
--source-db-url Database specification for source
system to dump from.
--source-remote-port Override sql database port number in
source-db-url. Optional.
--source-remote-host Remote machine to run sql-dump file
on. Optional; default is local
machine.
--source-dump Path to dump file. Optional; default
is to create a temporary file.
--target-database A key in the $db_url (D6) or
$databases (D7+) array which shall
receive the data.
--source-target Oy. A key within the
--target_database identifying a
particular server in the database
group.
--target-db-url
--target-remote-port
--target-remote-host
--target-dump
--target-target Oy. A key within the
--target_database identifying a
particular server in the database
group.
--temp Use a temporary file to hold dump
files. Implies --no-cache.
--dump-dir Directory to store sql dump files in
when --source-dump or --target-dump
are not used. Takes precedence over
--temp.
--create-db Create a new database before
importing the database dump on the
target machine.
--db-su Account to use when creating a new
database. Optional.
--db-su-pw Password for the "db-su" account.
Optional.
--no-ordered-dump Do not pass --ordered-dump to
sql-dump. sql-sync orders the
dumpfile by default in order to
increase the efficiency of rsync.
--sanitize Obscure email addresses and reset
passwords in the user table
post-sync. Optional.
--sanitize-password The password to assign to all
accounts in the sanitization
operation, or "no" to keep passwords
unchanged. Default is "password".
--sanitize-email The username for test email
addresses in the sanitization
operation, or "no" to keep email
addresses unchanged. May contain
replacement patterns %uid, %mail or
%login. Default is
"user+%uid@localhost".
--confirm-sanitizations Prompt yes/no after importing the
database, but before running the
sanitizations
Topics:
docs-aliases Site aliases overview with examples
docs-policy Example policy file
- user-add-role
Add a role to the specified user accounts.
Examples:
drush user-add-role "power user" 5,user3 Add the "power user" role to the
--uid=2,3 --name=someguy,somegal accounts with name, id, or email 5
--mail=billgates@microsoft.com or user3, uids 2 and 3, names
someguy and somegal, and email
address of billgates@microsoft.com
Arguments:
role The name of the role to add
users (optional) A comma delimited list of
uids, user names, or email
addresses.
Options:
--uid A comma delimited list of uids
--name A comma delimited list of user names
--mail A comma delimited list of user mail
addresses
Aliases: urol
- user-block
Block the specified user(s).
Examples:
drush user-block 5,user3 --uid=2,3 Block the users with name, id, or
--name=someguy,somegal email 5 or user3, uids 2 and 3,
--mail=billgates@microsoft.com names someguy and somegal, and email
address of billgates@microsoft.com
Arguments:
users A comma delimited list of uids, user
names, or email addresses.
Options:
--uid A comma delimited list of uids to
block
--name A comma delimited list of user names
to block
--mail A comma delimited list of user mail
addresses to block
Aliases: ublk
- user-cancel
Cancel a user account with the specified name.
Examples:
drush user-cancel username Cancel the user account with the
name username and anonymize all
content created by that user.
Arguments:
name The name of the account to cancel
Aliases: ucan
- user-create
Create a user account with the specified name.
Examples:
drush user-create newuser Create a new user account with the
--mail="person@example.com" name newuser, the email address
--password="letmein" person@example.com, and the password
letmein
Arguments:
name The name of the account to add
Options:
--password The password for the new account
--mail The email address for the new
account
Aliases: ucrt
- user-information
Print information about the specified user(s).
Examples:
drush user-information Display information about any users
2,3,someguy,somegal,billgates@microsoft. with uids, names, or mail addresses
com matching the strings between commas.
Arguments:
users A comma delimited list of uids, user
names, or email addresses.
Options:
--full show extended information about the
user
--short show basic information about the
user (this is the default)
Aliases: uinf
- user-login
Display a one time login link for the given user account (defaults to uid 1).
Examples:
drush user-login ryan Displays a one-time login link for
the user ryan.
open `drush user-login ryan` Open web browser and login as user
ryan.
Arguments:
name The name of the account to log in
as. Leave it empty to log in as uid
1.
Aliases: uli
- user-password
(Re)Set the password for the user account with the specified name.
Examples:
drush user-password someuser Set the password for the username
--password="gr3@tP@$s" someuser to gr3@tP@$s.
Arguments:
name The name of the account to modify
Options:
--password (required) The new password for the
account
Aliases: upwd
- user-remove-role
Remove a role from the specified user accounts.
Examples:
drush user-remove-role "power user" Remove the "power user" role from
5,user3 --uid=2,3 --name=someguy,somegal the accounts with name, id, or email
--mail=billgates@microsoft.com 5 or user3, uids 2 and 3, names
someguy and somegal, and email
address of billgates@microsoft.com
Arguments:
role The name of the role to remove
users (optional) A comma delimited list of
uids, user names, or email
addresses.
Options:
--uid A comma delimited list of uids
--name A comma delimited list of user names
--mail A comma delimited list of user mail
addresses
Aliases: urrol
- user-unblock
Unblock the specified user(s).
Examples:
drush user-unblock 5,user3 --uid=2,3 Unblock the users with name, id, or
--name=someguy,somegal email 5 or user3, uids 2 and 3,
--mail=billgates@microsoft.com names someguy and somegal, and email
address of billgates@microsoft.com
Arguments:
users A comma delimited list of uids, user
names, or email addresses.
Options:
--uid A comma delimited list of uids to
unblock
--name A comma delimited list of user names
to unblock
--mail A comma delimited list of user mail
addresses to unblock
Aliases: uublk
Command list generated by drush help --html
. Use this technique to publish your organization's command list to your intranet.