env
ShellFundamentals In simulator In real LinuxShow the environment or run a command in a modified one
Name: env = environment
You can practise it right away in the simulator, and use it in real Linux mode too.
Description
With no arguments env prints the environment. It can also run a command in a modified environment, e.g. env LANG=C sort file, affecting only that command.
The shebang #!/usr/bin/env bash relies on env to find the interpreter in PATH.
Syntax
env [NAME=VALUE]... [COMMAND]Common options
| NAME=VALUE | Set variables, then run the command, e.g. env LANG=C sort f |
| -i / --ignore-environment | Start with an empty environment |
| -u / --unset NAME | Remove a variable from the environment |
| -C / --chdir DIR | Change to DIR before running the command |