printenv Linux Commands
What is Linux printenv Command?
Explanation
printenv COMMAND:printenv command is used to list out all the environment variables. User can pipe the printenv to display minimal environment variables.
SYNTAX :
printenv
OPTIONS:
--help |
display this help and exit. |
--version |
output version information and exit. |
EXAMPLE:
-
printenv
Output:
ORBIT_SOCKETDIR=/tmp/orbit-kumar
HOSTNAME=localhost.localdomain
IMSETTINGS_INTEGRATE_DESKTOP=yes
GPG_AGENT_INFO=/tmp/keyring-FZm9Pe/gpg:0:1
SHELL=/bin/sh
TERM=xterm
HISTSIZE=1000
XDG_SESSION_COOKIE=6207a854c23dd7a33b31a8000000000e-
1372911576.138474-1634647969
WINDOWID=81793083
GNOME_KEYRING_CONTROL=/tmp/keyring-FZm9Pe
IMSETTINGS_MODULE=none
USER=kumar
You may print all or part of the environment variables using this command.
-
printenv | grep NAME
Output:
HOSTNAME=localhost.localdomain
USERNAME=kumar
LOGNAME=kumar
G_BROKEN_FILENAMES=1
In the above example, you can print minimal environment variables using the pipe option.