env is a POSIX 7 way:
export asdf=qwer
env | grep asdf
Sample output:
asdf=qwer
It only shows exported variables: non-exported variables are not usually considered "environment variables".
Prefer that over printenv
, which is not POSIX. Both seem to do the same thing without arguments: http://unix.stackexchange.com/questions/123473/what-is-the-difference-between-env-and-printenvhttps://unix.stackexchange.com/questions/123473/what-is-the-difference-between-env-and-printenv