env¶
Cross-platform environment variable management.
Synopsis¶
Description¶
List, get, set, or filter environment variables. Works consistently across Windows, macOS, and Linux.
Flags¶
| Flag | Short | Description | Default |
|---|---|---|---|
--format |
-f |
Output format: plain, json, shell, powershell |
plain |
--filter |
Filter variables by prefix (case-insensitive) | ||
--sort |
-s |
Sort variables alphabetically | true |
--keys |
-k |
Show only variable names | false |
--values |
-v |
Show only variable values | false |
--get |
-g |
Get a specific environment variable | |
--set |
Set variable (KEY=VALUE) and run command | ||
--unset |
-u |
Unset variable and run command | |
--export |
-e |
Output in export format for shell sourcing | false |
--no-empty |
Hide variables with empty values | false |
Examples¶
List all environment variables:
Get a specific variable:
Filter by prefix:
JSON output:
Shell export format:
PowerShell format:
Set variable and run command:
Unset variable and run command:
Show only keys:
Hide empty values:
Sample Output¶
Plain format:
JSON format:
Shell export format: