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 am running an application which requires setting environment variables to be set.

At the moment, the way I am achieving this is by exporting the EV at the command line, and then running the app from the command line.

I want to be able to run the app from my menu (it is already a menu item after I installed it).

How may I set the env var so that it is always available, so I can just run the app from the menu instead of from the CLI?

share|improve this question
systemwide or per-user? – akira Sep 4 '10 at 10:43

Add the environment variable declarations to the file .profile in your home directory:

export NAME='value'

If there are single quotes in the value, replace them by '\'' (there are other quoting mechanisms, this one is just the simplest to explain).

If you want to make the variables available to all users, add the declarations to /etc/profile.d/ (replace my-app-environment by a more descriptive name).

share|improve this answer
Did Lucid change /etc/profile from a file to a directory? – Dennis Williamson Sep 4 '10 at 15:03
@Dennis: no, I meant /etc/profile.d, thanks for pointing it out. Since at least Ubuntu 8.04 and Debian lenny, /etc/profile sources /etc/profile.d/*.sh. – Gilles Sep 4 '10 at 18:39
@Dennis, No - /etc/profile file loads what is in /etc/profile.d directory – laurent Sep 4 '10 at 18:40
@laurent: Yes, I know. It was a typo that threw me. – Dennis Williamson Sep 4 '10 at 18:59

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.