Super User is a question and answer site for computer enthusiasts and power users. 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

I'm working on Linux,

Can anybody please help me to set a env variable on Linux that will be available for all process running on the same machine?

share|improve this question

migrated from stackoverflow.com Oct 6 '12 at 7:05

This question came from our site for professional and enthusiast programmers.

    
Not programming related. – Burhan Khalid Oct 4 '12 at 7:58
up vote 0 down vote accepted

You have to write the definition of your env variable into /etc/profile :

VARIABLE=content

If that doesn't work, you could try /etc/environment

share|improve this answer
    
That won't reach all processes, only those started from a users shell. – arkascha Oct 4 '12 at 8:00
    
I added /etc/environment – FSMaxB Oct 4 '12 at 8:11
    
Sounds better, though it depends on the PAM configuration. I wonder if it is possible to hand that environment variable to the init process. All other processes are started by that one, so they all inherit that variable. – arkascha Oct 4 '12 at 9:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .