Since Drush 9 the @sites alias to run a command on all available multi-site instances has been removed from Drush core.

$ drush @sites cr

  The alias @sites could not be found.

Is there a way to get the same behaviour that does not require me typing my 300 multi-site instance names in a config file?


3 Answers 3


Waiting something similar, I wrote this small script I called "drall" you may adapt:


// Path to sites.php file.

$done = [];
$argv = $_SERVER['argv'];


$parameters     = implode(' ', $_SERVER['argv']);
$commandPattern = "drush --uri=:key $parameters";

foreach ($sites as $key => $site) {

  if (count($argv) > 1 && !in_array($site, $done)) {

    $command = str_replace(':key', $key, $commandPattern);
    echo "Executing command `$command` on $site\n";
    $done[] = $site;

Use example:

$ ./drall cc render
Executing command `drush --uri=xxxxxxx cc render` on default
 [success] 'render' cache was cleared.

Hope there will be some @sites behaviors later, that was helpfull.

Although from this issue it doesn't look like it:

Drush 9 no longer supports executing a single command on multiple sites with alias lists (@A,@b,@c) or @sites. Neither of those syntaxes are available in any context. You may still use drush sa @group to see all aliases in a group; that is the only context in which Drush recognizes alias lists.

  • Thank you, the script works just fine. One thing which doestn work, are the promts. you cannot see them but can interact with them. Any ideas how to enhance your script? Commented Jun 5, 2018 at 20:23
  • tried echo `$command`; but it shows me only the output not the prompts Commented Jun 5, 2018 at 20:33
  • use -y at the end of your command, it will not show the y/n prompt this way. Commented Jun 11, 2018 at 6:28
  • What if I do want to see them? E.g. config-import. Commented Jun 11, 2018 at 6:45
  • maybe run it in a single site before Commented Jun 11, 2018 at 6:53

I'd simply place a lightweight loop into your ~/.bashrc or ~/.bash_profile or where ever you prefer. Just update the SITES=( foo bar ) array to your needs.

Source your bash file, cd into your multi-site root and call ddrush cim -y for example and it will iterate through all sites provided in the SITES array.

ddrush () {
  # Provide an array of sites you want to loop.
  SITES=( foo bar )

  # Validate and hint if no argument provided.
  if [ "${#}" -eq 0 ]; then
    echo "- ddrush: missing argument(s)"
    echo "EXAMPLE: ddrush cex -y"
    # Loop:
    for SITE in "${SITES[@]}"; do
      echo "drush -l ${SITE} ${@}"
      drush -l "${SITE}" "${@}"

You can use nearly the same for running a deployment script. Or you could easily provide multiple aliases like that. adrush, bdrush, cdrush – one for every multi-site environment you need to maintain.

I only now read you have 300 instances running. Respect! Well, then it might be easier to only provide an absolute path to the sites folder and have that scanned and then looped through automatically.

xdrush () {
  # Provide the absolute path to the sites directory.

  # Validate and hint if no argument provided.
  if [ "${#}" -eq 0 ]; then
    echo "- xdrush: missing argument(s)"
    echo "EXAMPLE: xdrush cex -y"
    cd "${SITES}"
    # Loop:
    for SITE in $(ls -d */ | cut -f1 -d'/'); do
      # Skip default site.
      if [ ! "${SITE}" == "default" ]; then
        cd "${PWD}"
        echo "drush -l ${SITE} ${@}"
        drush -l "${SITE}" "${@}"

An out-of-the-box solution is provided by a package named jigarius/drall.

I wrote that package and I've used it on a number of multi site Drupal installations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.