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 know they get read from /etc/env.d/ but I tried adding in my own file in there (00example) with a single env variable but they aren't picked up after either env-update.

How does a user declare them globablly and why did my method not work?

linux 3.0.6

share|improve this question
up vote 1 down vote accepted

See : you need to run env-update so that your file gets merged into /etc/profile.env.

share|improve this answer
I ran env-update nothing happened. – rutherford Dec 21 '11 at 14:20
what about env-update && source /etc/profile ? Check that your variable is stored in /etc/profile.env... – chickenkiller Dec 21 '11 at 14:21
that worked cheers - what's the reason? – rutherford Dec 21 '11 at 14:43
maybe your /etc/profile is not sourced at boot... did you log in as root? Maybe /etc/profile is handled differently for root user... Not sure... – chickenkiller Dec 21 '11 at 14:45
The file /etc/profile is only read when a login shell is starting up. Changes to it will not take effect automatically; you need to log in again, or do source /etc/profile manually. – Kevin Panko Dec 21 '11 at 15:35

If you created the file /etc/env.d/00example, it would only get set when you attempt to run the command example. Are you sure you aren't looking for setting variables in /etc/env.d/99local (or /etc/profile)?

share|improve this answer
the file name has nothing to do with commands typed later. /etc/env.d is only used to organise global environment variables in several files for clarity. – chickenkiller Dec 21 '11 at 14:19
maybe - what's 99local? It's not in my system at the moment – rutherford Dec 21 '11 at 14:24
It's what the docs say to stick system wide user variables, but chickenkiller is right, the names doesn't matter, just the order that they get created/appended. Out of curiosity, what variable did you attempt to set? – Jon Lin Dec 21 '11 at 14:35
also, make sure the files starts with 2 real digits (0 and not O for example), the python code that parses your file is touchy about it... see… – chickenkiller Dec 21 '11 at 14:40

add name=value pairs to /etc/env.d/##identifier (where ## are two decimal digits and identifier is a memorable name), then sudo env-update and source /etc/profile. see the Gentoo Handbook under "Working with Gentoo: Environment Variables".

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.