Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've an environment variable ($M2_HOME) which I'd like to modify. The thing is, I can't find where I originally set it - this is quite bizarre as I exclusively use ~/.bash_profile.

Are there any commands I can use to somehow reflectively inspect set environment variable?

share|improve this question
I assume you use Maven? Can you tell us more about how this variable is being used? Is it always set, even if you don't actually run anything related to Maven? Does it maybe have a configuration file that is parsed when it's run? – slhck Feb 13 '12 at 9:45
In the latter case, why not do a search for the occurrence of M2_HOME somewhere? – slhck Feb 13 '12 at 9:46

No, the only thing you can do is search all possible locations.

The environment is just a list of C strings in "key=value" format, it does not carry any metadata about when and where the variables have been set.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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