Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

So when I invoke emacs from the terminal, all my environment variables are loaded correctly from .bashrc. However, when I load emacs from the Ubuntu Application menu (by invoking the /usr/share/applications/emacs24.desktop) it loads no environment variables. Can I adjust the desktop setting to do so?

share|improve this question
up vote 1 down vote accepted

.bashrc is not the right place to define environment variables, as you've discovered. This file is only read when you start an interactive shell (specifically, only when you start an interactive instance of bash, not of other shells). The environment is then inherited by the processes started from that shell (each process has its own environment, inherited from its parent process). So if you start a program directly from the GUI, it never had a chance to see these environment variables.

Define environment variables in ~/.profile or in ~/.pam_environment. Both files are read when you log in.

For more information, see Alternative to .bashrc and What's the best distro/shell-agnostic way to set environment variables?

share|improve this answer
thanks this worked – octi Sep 11 '13 at 13:00

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.