Questions tagged [environment-variables]

Environment variables are configuration options that can be set in a shell or other similar environments. All programs started from within the shell can read them and configure themselves.

Environment variables are key-value-pair configuration options like KEY=valueor FOO=bar. Environment variables allow you to configure a program before it gets executed and without the need to store these variables in proprietary configuration files.

They are present on all POSIX systems (Unix, Linux, BSD, Mac OS, DOS, Windows, ...). Environment variables can be set by any shell and read by nearly any programming language.

Some programming languages allow you to set Environment variables, but they only persist within the current process. You can't set them to be visible by the calling shell. So they are not useful for inter-process communication.

401 questions
244
votes
13 answers

Environment variables of a running process on Unix?

I need to troubleshoot some problems related to environment variables on a Unix system. On Windows, I can use a tool such as ProcessExplorer to select particular a process and view values of each environment variable. How can I accomplish the same…
Gant
  • 2,585
  • 2
  • 16
  • 8
216
votes
7 answers

How do you add a Windows environment variable without rebooting?

I would like to add an Environment variable to a Windows machine (desktop or server) and be able to use it without rebooting that machine. Say you have a production server which hosts a variety of apps and a new app needs a particular Environment…
Chad Braun-Duin
  • 2,179
  • 3
  • 14
  • 11
55
votes
4 answers

Can the environment variables tool in windows be launched directly?

Is there a more direct way to the environmental variables GUI then... Right click 'My Computer' and select 'Properties'. Click 'Advanced System Settings' link. Click 'Advanced' tab. Click 'Environment Variables...' button. Can I make a shortcut to…
JasonV.com
  • 711
  • 1
  • 6
  • 6
41
votes
2 answers

CentOS /usr/local/lib system wide $LD_LIBRARY_PATH?

I install custom software in /usr/local/lib. How do I set the PATH and LD_LIBRARY_PATH in CentOS 6 system-wide to use /usr/local/lib. I realize there may be more than one way. What's the simplest and most standard way?
unixman83
  • 1,912
  • 8
  • 25
  • 33
33
votes
5 answers

Is it possible to change value of $TERM when calling ssh?

On my local terminal, I have TERM=konsole-256color, but not all remote machine I connect to have this definition. Is it possible to make ssh change the TERM on remote machine? Without changing .bash* scripts on remote machine, just by changing…
user13185
32
votes
4 answers

crontab execution doesn't have the same environment variables as executing user

I ran my crontab job 0 2 */1 * * /aScript >aLog.log 2>&1 as a 'root' user, and however I found the env is different from env of the 'root' user, and therefore experiencing a different runtime behavior of my scripts. An attempt fix was placing export…
Bamboo
  • 425
  • 1
  • 4
  • 8
32
votes
4 answers

Use an environment variable in a launchd script

I'm curious if it's possible to specify an envrionment variable in the ProgramArguments portion of a luanchd script on Mac OS X Leopard.
matpie
  • 453
  • 1
  • 5
  • 9
30
votes
8 answers

What is the best place to setup system wide environment variables on Linux?

I just want to setup a system wide environment variable, JAVA_HOME for all users, including root user. Requirements: accessible to normal users accessible to root always loaded, not only for bash (gnome-terminal does not start a bash by…
sorin
  • 7,668
  • 24
  • 75
  • 100
29
votes
1 answer

How to set environment variable for another user?

On Windows, how do I set an environment variable for a user other than the currently logged in one? I need to set the TMP variable to change the temporary directory used by an ASP.NET app.
George Mauer
  • 479
  • 3
  • 7
  • 13
28
votes
1 answer

Make IIS see updated environment PATH variable

We've installed Oracle Express on a Windows 2003 Server and in the process it updated the PATH. We're trying to get IIS to see this change in the PATH but we can't figure it out. We've recycled the app pool and the IIS site with no success. Is there…
Mark
  • 1,991
  • 6
  • 18
  • 18
26
votes
6 answers

What are the advantages of putting secret values of a website as environment variables?

The devops guidelines at https://12factor.net/config suggest to put website secrets (database passwords, api keys, etc.) into environment variables. What advantages does that have instead of using text files (JSON, XML, YAML, INI, or similar)…
26
votes
6 answers

Setting a variable for a given SSH host

In ssh_config, one can choose to export some environment variables to the host using SendEnv. Is there also a way to force a given value for this variable, per host? For example, would it be possible to export variable $FOO with value bar only when…
raphink
  • 11,337
  • 6
  • 36
  • 47
26
votes
6 answers

How can I modify a user’s PATH environment variable without logging out?

The question pretty much says it all; I have users who do not have permission to edit their own PATH environment variable and if they need to have it modified for some reason, they need to log out so an Admin can log in and change the PATH for them,…
ninesided
  • 499
  • 2
  • 7
  • 9
20
votes
4 answers

Using environment variables in Kubernetes deployment spec

I currently use a Kubernetes spec Deployment.yaml for deploying a service. The spec includes a verbatim reference to a specific IP address (marked as below): spec: type: LoadBalancer loadBalancerIP: I am…
Drux
  • 646
  • 1
  • 8
  • 23
19
votes
4 answers

Is there a utility to read environment variables from an env file and then run a command (more lightweight than foreman)?

foreman can read .env files and set environment variables from the contents, and then run a program e.g. foreman run -e vars.env myprogram ...but it does a lot of other things (and is primarily concerned with starting things using its Procfile…
wodow
  • 590
  • 1
  • 5
  • 18
1
2 3
26 27