Skip to content

Drush commands

The sites:* commands. Any Drush command runs in the context of a site when given that site's URL: drush --uri=https://acme.example.com ….

sites:clone

Clones a site: its settings, its content and the links of its menus.

The content follows the source's cloning rules unless --method names a method for it. The clone starts disabled.

Aliases: sclone

Argument Required Description
source yes The id of the site to clone.
id yes The clone's id (a machine name).
title yes The clone's name.
Option Description Default
--hostname The hostname of a main site.
--main-site The main site a sub-site lives under (needs the Sites path prefix module).
--prefix The path prefix of a sub-site.
--languages Langcodes the clone speaks, comma-separated; the source's default is always among them. Without it the clone speaks the source's languages.
--default-language The clone's default language, one of --languages. Without it the source's.
--method A clone method for one content key, as "node:page=clone_content". Repeatable. A key not named follows the source's cloning rules.
--no-menus Do not copy the links of the source's per-site menus, whatever its cloning rules say. false

Examples:

  • drush sites:clone acme acme_de "Acme DE" --hostname=acme.de: Clone acme by its own cloning rules.
  • drush sites:clone acme acme_de "Acme DE" --hostname=acme.de --languages=de --method=node:page=clone_content: A German-only clone that copies the pages.

sites:create

Creates a site, disabled until sites:enable puts it in service.

Aliases: sc

Argument Required Description
id yes The site id (a machine name).
title yes The site name.
Option Description Default
--hostname The hostname of a main site.
--main-site The main site a sub-site lives under (requires the Sites Path Prefix module).
--prefix The path prefix of a sub-site.
--type The site type. Optional when only one site type exists.

Examples:

  • drush sites:create acme "Acme Inc." --hostname=acme.example.com: A main site on its own hostname.
  • drush sites:create acme_jobs "Acme Jobs" --main-site=acme --prefix=jobs: A sub-site under acme at /jobs.

sites:delete

Deletes a site.

Aliases: sdel

Argument Required Description
site yes The site id.
Option Description Default
--content What becomes of the site's content: detach (it stays, unscoped), reassign (exclusive content moves to --reassign-to) or delete (exclusive content is deleted). Shared content is only ever detached. reassign and delete require the Sites Content module. detach
--reassign-to The site that takes over exclusive content with --content=reassign.

Examples:

  • drush sites:delete acme: Delete acme; its content stays, no longer belonging to it.
  • drush sites:delete acme --content=reassign --reassign-to=globex -y: Move what only acme held to globex, then delete acme.

sites:disable

Takes a site out of service; its content and settings stay.

Argument Required Description
site yes The site id.

Examples:

  • drush sites:disable acme: acme stops answering on its host.

sites:enable

Puts a site in service.

Argument Required Description
site yes The site id.

Examples:

  • drush sites:enable acme: acme answers on its host.

sites:info

Shows a site: its identity, its resolved settings, its config overrides.

Aliases: si

Argument Required Description
site yes The site id.
Option Description Default
--environment Resolve settings and overrides for this environment instead of the current one.
--format Format the result data. Available formats: csv,json,list,null,php,print-r,string,table,tsv,var_dump,var_export,xml,yaml yaml
--fields Limit output to only the listed elements. Name top-level elements by key, e.g. "--fields=name,date", or use dot notation to select a nested element, e.g. "--fields=a.b.c as example".
--field Select just one field, and force format to string.

Examples:

  • drush sites:info acme: The acme site as YAML.
  • drush sites:info acme --environment=stage --format=json: What acme resolves to on stage.

sites:list

Lists the sites of the platform.

Aliases: sl

Option Description Default
--format Format the result data. Available formats: csv,json,list,null,php,print-r,sections,string,table,tsv,var_dump,var_export,xml,yaml table
--fields Available fields: ID (id), Name (label), Type (type), Structure (structure), Host (host), Enabled (enabled), Base URL (base_url)
--field Select just one field, and force format to string.

Examples:

  • drush sites:list: Every site as a table.
  • drush sites:list --format=json: The same with the base URL, as JSON.