Archive for the tag 'environment'

SBDavid

Global environment variables

To view the global environment variables, use the printenv command:

root@dell:~# printenv
SSH_AGENT_PID=3334
SHELL=/bin/bash
TERM=xterm
WINDOWID=14680078
USER=root
http_proxy=192.168.1.1:3128
SSH_AUTH_SOCK=/tmp/ssh-ONJxpP3279/agent.3279
MAIL=/var/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DESKTOP_SESSION=IceWM

Global environment variables are visible from the shell session, and any child processes that the shell spawns. Local variables are only available in the shell that creates them. This makes global environment variables useful in applications that spawn child processes that require information from the parent process.

The Linux system sets several global environment variables when you start your bash session (for more details about what variables are started at that time, see the ‘‘Locating System Environment Variables’’ section later in this chapter). The system environment variables always use all capital letters to differentiate them from normal user environment variables.

How can I see the environment variables a process is running with?

You can run the following command:

ps auxwwe |grep processname

« Prev