Chapter 21
What's In Your Environment (env, echo, Env:)

21.1 Do This

Source 39: Linux/Mac OSX Exercise 21
  $ env
  $ env | grep zed
  $ echo $USER
  $ echo $PWD
  $ export TESTING="1 2 3"
  $ echo $TESTING
  1 2 3
  $ env | grep TESTING
  TESTING=1 2 3

Source 40: Windows Exercise 21
  > get-childitem Env:
  Name                           Value
  ----                           -----
  ALLUSERSPROFILE                C:\ProgramData
  APPDATA                        C:\Users\zed\AppData\Roaming
  > $env:PROMPT
  > $env:TEMP
  > $env:OS

21.2 You Learned This

Your shell has these "hidden variables" that can change how other programs work. In this exercise I first print out my environment, just dumping it to the screen. Then I do it again but pipe it through grep to find only the variables with my username in them. Finally, I set an environment variable TESTING to "1 2 3".

You may not run into this too often, but sometimes to get something configured you have to change these. A good example is the PATH variable, which determines the search order for other commands. Changing your PATH is going to be one of your exercises.

21.3 Do More

  1. I want you to go online and research how you change your PATH for your computer. Try to do it entirely from the CLI.

Online Video Course + PDF For $9

For the price of most other course's PDFs only, you can get the full PDF for this class and 2 videos demonstrating the whole book for both Unix/OSX Terminal and Windows PowerShell. The course is self-paced so you can go through it any time you want, as many times as you want.

Signup Now At For $9