Take the 2-minute tour ×
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

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

1 Answer 1

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


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


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