I have installed drush via terminal, but how do I link it to my 2 local drupal sites? When I do drush status I get this:

PHP configuration : /etc/php/7.0/cli/php.ini PHP OS : Linux
Drush script : /usr/local/bin/drush
Drush version : 8.1.2
Drush temp directory : /tmp
Drush configuration :
Drush alias files :

So how do I now link the drush to my two virtual host drupal sites? I looked online for a tutorial or guide, but I don't quite understand the ones I found on how to link them.

1 Answer 1


There are several ways to tell Drush which Drupal site you would like it to operate on.

  1. Run Drush from the directory that contains the Drupal site's settings.php file. $ cd /path/to/drupal_root/sites/default $ drush status
  2. Pass --root and --uri options that identify the site: $ drush --root=/path/to/drupal_root --uri=http://mysite.dev status
  3. Create a site alias, and use that $ drush @mysite status In order to use the last option, you must define the mysite alias as described in the example aliases file.


The --uri option is used (a) to select which settings.php to use, and (b) to set the $_SERVER superglobal. If your settings.php file is in the default directory, then --uri is not necessary to bootstrap. However, some modules will expect the URI to be set up correctly; in some instances, you will not get the correct results if this setting is omitted.

  • Isn't moving to Drupal root enough?
    – ya.teck
    Commented Jun 17, 2016 at 9:11
  • Second option (uri) is not required to bootstrap Drupal.
    – ya.teck
    Commented Jun 17, 2016 at 9:11
  • Thanks for the info. I just went to my directory www/var/*nameofsitefolder* and right clicked and selected "open terminal from here", and that put me in "master mode" on the terminal and I was able to run Drush commands. Thanks ^_^
    – Shawn
    Commented Jun 18, 2016 at 12:45

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.