Currently I have to manage a few servers and there are a bunch of Drupal directories that all look alike. I'm also logged in as admin on the site, but what I want to find out is:

  • How can I tell if I'm working in the correct directory as the site I'm viewing?
  • What are some drush commands I can use to tell if I am in fact in the correct directory?

3 Answers 3


drush status may give you some info that you need, but probably not.

If you have unique site names setup, then this should work:

drush vget site_name

If not, then read on...

Is this a multisite setup? If so, then the mapping of hostname onto sites/{sitename} will be either fully automatic based on these rules or determined by the configuration in sites.php.

If it's not a multisite setup and you instead have fully separate directories for each site then the mapping of hostname > directory is determined by your vhost setup.

In either case, I don't think there's any drush command that will just spit out which hostname you should be using to access the site based upon the directory you run it in.

Instead, I'd suggest you set up some drush aliases that let you be much more purposeful about running drush commands against a specific directory and hostname. So, if you have a site at example.com, a simple alias might look like

$aliases['example.com'] = array(
 'root' => '/path/to/example',
 'uri' => 'example.com',

Then, anytime you want to run drush commands against example.com it doesn't matter what directory you're in, as long as you have access to drush (stick it in your path) you can run:

drush @example.com arbitrarydrushcommandhere

Take the time to set up your aliases and hopefully you'll be more sane.

  • I added the site_name solution as a possible option that may work well for you.
    – Aaron
    Aug 6, 2015 at 20:06

I like to use the environment_indicator module -- the 1.x version, not the 2.x version. This module places a sidebar in the web-browser using a message set in your settings.php file. Tail your settings.php file, and you can see if the sidebar matches what you see in the current code.

Version 2.x of environment_indicator stores the messages for all environments in the database, and then tries to determine which one to display based on the runtime environment -- less useful than simply customizing settings.php, in my opinion.

  • A solid answer. I just wanted to add that even the 2.x version supports settings.php overrides like so: $conf['environment_indicator_overwrite'] = TRUE; $conf['environment_indicator_overwritten_name'] = 'Arbitrary environment name here';
    – Aaron
    Aug 6, 2015 at 21:18

One easy way i believe was searching for the last login via drush command:

drush sql-query 'select uid, access, login, name from users order by access desc limit 3 \G'

That will return the last few logins and you'll know if your on the correct site as it will show your username.

This is assuming your username is unique from admin. But if its admin, then that might be a little tricky.

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.