env
What is env?
env: Environment — List all environment variables, or run a command with a specific environment. env shows the environment variables of the current shell, or runs a command with a modified environment. env | grep APP lists variables starting with APP; env APP_ENV=testing php artisan test runs the tests with a different value without changing your shell.
Frequently asked questions about env
How is env used in practice?
Environment variables are how most applications receive configuration: database credentials, API keys and feature switches. When an application behaves differently than expected, checking what it actually sees is a quick first step.
What should you keep in mind with env?
You often see #!/usr/bin/env python3 at the top of scripts. It finds the interpreter on the user's PATH, which makes the script work across systems where Python lives in different places. Be careful when printing the environment on shared screens or in CI logs, since it may contain secrets.
At a glance
| Category | CLI commands |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |