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

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
Not programming related. – Burhan Khalid Oct 4 '12 at 7:58

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

1 Answer

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

Your Answer

 
discard

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