Sventimir
Sventimir

Reputation: 2056

Where does Linux environemnt live?

I've always believed that environment variables live within the shell current user is logged into. However recently I've begun working on a shell of my own and learning more about how Linux works under the hood. Now it seems to me, that the environment is shell-independent and handled elsewhere (in the kernel?). So my question is how exactly does it work? Which part of the system is responsible for holding the environment?

Also for instance Bash makes the distinction between export-ed and unexported variables, the latter of which are not inherited by a subshell. Does that mean that each process is the system has it's own set of shell variables?

Upvotes: 0

Views: 74

Answers (1)

Nuetrino
Nuetrino

Reputation: 1119

Yes each process will have its own set of enviornment.

You can find them at

cat /proc/<pid>/environ

Upvotes: 2

Related Questions