The env command stands for “environment,” and returns a list of the environment variables for the current user.

What happens when you type the env command?


The env command returns a number of variables, including PATH, PWD, PS1, and HOME. To select the value of a particular environment variable, let’s say PATH, you can use the following command:

env | grep PATH

the command above displays the value of the PATH environment variable. Here the standard output of env is “piped” to the grep command. grep searches for the value of the variable PATH and outputs it to the terminal. Note that this is the same output as echo $PATH.



In the command line type:


You should see a list of variables and their values.


Then specifically display the value of the PS1 environment variable using env, grep, and redirection.

The output should match what the command prompt looks like right now!

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?