Shell
env
Run a command in a modified environment or print current environment variables.
Synopsis
syntax
env [OPTION]... [NAME=VALUE]... [COMMAND]
Examples
Print all environment variables
env
Run command with temporary variable
env NODE_ENV=test npm test
Start minimal shell environment
env -i HOME=$HOME bash --norc
Run without DEBUG variable
env -u DEBUG node app.js
Common options
| Flag | Description |
|---|---|
| -i | Start with empty environment |
| -u | Remove variable from environment |
| -0 | NUL-separated output |
About env
The `env` command run a command in a modified environment or print current environment variables. Shell commands configure your interactive environment — variables, aliases, history, and shell options.
The shell is your primary interface with Linux, and customizing it improves productivity. These commands work across bash, zsh, and other POSIX-compatible shells with minor differences.
The command accepts 3 commonly used flags shown above, though the full set of options is available in the man page (`man env`). The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Shell Commands
Other commands in the Shell category