If I type into a terminal,
export DISPLAY=:0.0
... where is the shell storing that environment variable?
I'm using Ubuntu 8.10. I've looked in the files ~/.profile and /etc/profile and can find no trace of DISPLAY.
In Linux and Unix based systems environment variables are a set of dynamic named values, stored within the system that are used by applications launched in shells or subshells.
Machine environment variables are stored or retrieved from the following registry location: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment . Process environment variables are generated dynamically every time a user logs in to the device and are restricted to a single process.
You can set your own persistent environment variables in your shell configuration file, the most common of which is ~/. bashrc. If you're a system administrator managing several users, you can also set environment variables in a script placed in the /etc/profile.
On Ubuntu, there are two system-wide environment variables, both files need admin or sudo to modify it. /etc/environment – It is not a script file, purely assignment expressions, one per line. /etc/profile. d/*.
The environment variables of a process exist at runtime, and are not stored in some file or so. They are stored in the process's own memory (that's where they are found to pass on to children). But there is a virtual file in
/proc/pid/environ
This file shows all the environment variables that were passed when calling the process (unless the process overwrote that part of its memory — most programs don't). The kernel makes them visible through that virtual file. One can list them. For example to view the variables of process 3940, one can do
cat /proc/3940/environ | tr '\0' '\n'
Each variable is delimited by a binary zero from the next one. tr replaces the zero into a newline.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With