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://www.hydrion.example …. Without any URI (from --uri, DRUSH_OPTIONS_URI, options.uri in drush.yml or the site alias) it runs on the hub. Cron always runs as the hub, whatever URI it is given. updatedb, deploy, config:import and queue:run run with the URI they are given and warn on stderr when that URI is a site's: run them with the hub's URI (The current site).

sites:alias-prune

Lists, or deletes, aliases in languages their site does not speak.

A site does not negotiate a language it does not speak: such an alias never resolves. Older versions wrote them on migration and generation. Without --delete the command only lists them. A language the site starts to speak later gets its aliases from the bulk generation.

Option Description Default
--delete Delete the aliases instead of listing them. false
--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: Site (site), Language (langcode), Aliases (count)
--field Select just one field, and force format to string.

Examples:

  • drush sites:alias-prune: Lists the aliases each site has in languages it does not speak.
  • drush sites:alias-prune --delete: Deletes them.

sites:assign-unassigned

Puts the content that belongs to no site on a site.

The command line's way through a large backlog — terms, blocks, media without an administration listing to select them in. Items of a bundle the site does not take are skipped and reported; a bundle no site takes is global content and is never touched; accounts are never assigned.

Aliases: sau

Option Description Default
--to The site that takes the content.
--type One entity type id, like node or taxonomy_term. Every site content type when empty.
--bundle One bundle of that type, like tags. Every bundle when empty.

Examples:

  • drush sites:assign-unassigned --to=hydrion: Puts every content item without a site on Hydrion.
  • drush sites:assign-unassigned --to=hydrion --type=taxonomy_term --bundle=tags -y: The tags without a site only, without asking.

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. A run that stops halfway exits with 1 and names the incomplete clone.

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 hydrion velmora "Velmora" --hostname=www.velmora.example: Clone hydrion by its own cloning rules.
  • drush sites:clone hydrion hydrion_de "Hydrion DE" --hostname=de.hydrion.example --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 velmora "Velmora" --hostname=www.velmora.example: A main site on its own hostname.
  • drush sites:create hydrion_fr "Hydrion FR" --main-site=hydrion --prefix=fr: A sub-site under hydrion at /fr.

sites:delete

Deletes a site.

Aliases: sdel

Argument Required Description
site yes The site id.
Option Description Default
--content What becomes of the content that belongs to the site only: reassign (it moves to --reassign-to) or delete. Required while such content exists; it is never left without a site. Content shared with other sites keeps its other sites either way. Both need the Sites Content module.
--reassign-to The site that takes over the content with --content=reassign.

Examples:

  • drush sites:delete velmora: Delete velmora, whose content all belongs to other sites too.
  • drush sites:delete velmora --content=reassign --reassign-to=hydrion -y: Move what only velmora held to hydrion, then delete velmora.
  • drush sites:delete velmora --content=delete -y: Delete what only velmora held, then velmora.

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 velmora: velmora stops answering on its host.

sites:enable

Puts a site in service.

Argument Required Description
site yes The site id.

Examples:

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

sites:export-content

Exports sites with their content as default content, for a recipe.

Writes each site, its role assignments and stored configuration overrides, the content that belongs to it (with its sites and site overrides) and everything those refer to, one YAML file per entity, as a recipe's content directory takes them. User accounts are written with their password hashes.

Aliases: sexc

Argument Required Description
directory yes The directory to write to, like a recipe's content directory.
Option Description Default
--sites The sites to export, by id, comma-separated. Every site when empty.

Examples:

  • drush sites:export-content ../recipes/valtora_demo/content: Exports every site and its content into a recipe.
  • drush sites:export-content /tmp/hydrion --sites=hydrion,hydrion_uk: Exports two sites and their content.

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 hydrion: The hydrion site as YAML.
  • drush sites:info hydrion --environment=stage --format=json: What hydrion 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.

sites:screenshot

Takes screenshots of sites' front pages: their thumbnails on the lists.

A site's own thumbnail (its Appearance setting) still wins.

Aliases: sss

Argument Required Description
ids The site ids; every site when none is given.

Examples:

  • drush sites:screenshot: Screenshots of every site.
  • drush sites:screenshot hydrion valtora: Screenshots of two sites.

Last updated 2026-11-22