env flags & options

(no flags)

Print all current environment variables.

env

-i, --ignore-environment

Start with a completely empty environment.

env -i PATH=/usr/bin bash

-u, --unset

Remove a variable from the environment before running the command.

env -u DEBUG ./app
env -u HTTP_PROXY -u HTTPS_PROXY curl https://example.com

-0, --null

End each output line with a null byte instead of newline, useful with xargs.

env -0 | xargs -0 -n1 echo

VAR=val command

Set one or more variables for the duration of a single command.

env NODE_ENV=production node server.js
env CC=clang CXX=clang++ make
env PGPASSWORD=secret psql -U admin -d mydb