Getting Started With Environment Variables in Linux...
Module 1:
What are environment variables?
- Set of dynamic named values
- They provide a way to influence the software behavior on a system
printenv and env commands ????
What are environment variables?What are environment variables?
- printenv - print all or part of environment
- env - run a program in a modified environment
Principles of Environment Variables …..
Module 2:
PROCESS LOCALITY ...
- The values of environment variables are local.
- These values are specific to the process in which or for which they
were set
Principles of Environment Variables …..
Module 3:
INHERITANCE...
- The Child process inherits (gets) all the environment variables from
parent with values
Note: Changes to env vars at run time by parent is not visible to child and vice versa
Process locality get applied here
Principles of Environment Variables …..
Module 4:
CASE SENSITIVITY...
- Env variables are case sensitive
- It is a common practice to name all env variables in English Capital
Letters and _ signs
Persistent Environment Variables (Session-wide Environment
Variables )...
Module 5:
Types:
- Session-wide Environment Variables
- System-wide Environment Variables
Session-wide Environment Variables
~/.pam_environment
~/.profile
Shell Config files
~/.bashrc
~/.bash_logout
~/.bash_history
Persistent Environment Variables (System-wide Environment
Variables )...
Module 6:
System-wide Environment Variables
- /etc/environment
- /etc/profile.d/*.sh
Other files:
-/etc/profile
-/etc/default/locale
-/etc/bash.bashrc

Environment Variables in Linux

  • 1.
    Getting Started WithEnvironment Variables in Linux... Module 1: What are environment variables? - Set of dynamic named values - They provide a way to influence the software behavior on a system printenv and env commands ???? What are environment variables?What are environment variables? - printenv - print all or part of environment - env - run a program in a modified environment
  • 2.
    Principles of EnvironmentVariables ….. Module 2: PROCESS LOCALITY ... - The values of environment variables are local. - These values are specific to the process in which or for which they were set
  • 3.
    Principles of EnvironmentVariables ….. Module 3: INHERITANCE... - The Child process inherits (gets) all the environment variables from parent with values Note: Changes to env vars at run time by parent is not visible to child and vice versa Process locality get applied here
  • 4.
    Principles of EnvironmentVariables ….. Module 4: CASE SENSITIVITY... - Env variables are case sensitive - It is a common practice to name all env variables in English Capital Letters and _ signs
  • 5.
    Persistent Environment Variables(Session-wide Environment Variables )... Module 5: Types: - Session-wide Environment Variables - System-wide Environment Variables Session-wide Environment Variables ~/.pam_environment ~/.profile Shell Config files ~/.bashrc ~/.bash_logout ~/.bash_history
  • 6.
    Persistent Environment Variables(System-wide Environment Variables )... Module 6: System-wide Environment Variables - /etc/environment - /etc/profile.d/*.sh Other files: -/etc/profile -/etc/default/locale -/etc/bash.bashrc