Here is the video version, if you prefer it:
Today we will talk about a special kind of operating system variables. As we already know, the operating system (and other computer programs) use variables, which are places in computer memory that store values relevant to a computer program. A special kind of operating system variables are environment variables. Let’s explain what “environment variables” mean.
Environment variables are the variables that the operating system passes to your shell programs. (Ward, 2014) What that means is that when you run your shell program, it has access to the environment variables. A shell program then uses those environment variables to read its configuration and options from them.
Here are some examples of environment variables I got by running
printenv, which is used to print all (or a part of) your environment. (“PRINTENV(1),” n.d.)
Here we can see
SESSION_MANAGER as names of my environment variables, while the strings right of the equal sign are the values of the variables.
Takeaway: Environment variables are passed by the operating system to your shell programs and they store configuration and options that shell programs take into account when they are executed.
Hope you learned something useful!
PRINTENV(1). (n.d.). Retrieved February 7, 2020, from http://man7.org/linux/man-pages/man1/printenv.1.html
Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Pages 21-22
Subscribe to my newsletter to keep abreast of the interesting things I'm doing. I will send you the newsletter only when there is something interesting. This means 0% spam, 100% interesting content.