The env command is used to run a command with modified environment variables. By supplying the name of a variable and a value in the key-value pair format, as well as supplying a command to run, you can change the value of the specified variable for that particular command session. If the variable does not exist, it will be added to the environment. Likewise, you can use the -u option to remove the specified variable from the environment in which the specified command runs. Consider using env if you want to override values in child processes or add new ones.

Issuing the command without any arguments will display all variables in the environment as well as their corresponding values.


The syntax of the env command is:

# env [options] [NAME=value] [command]

Listing environment variables and their values:

env command examples in Linux

env Command Examples

1. To run a program to ignore environment:

# env -i
# env --ignore-environment 

2. To end each output line with 0 byte rather than newline:

# env -0
# env --null 

3. To remove a variable from the environment:

# env -u NAME
# env --unset=NAME 

4. To display the help:

5. To display the version: