Displaying Environment Variables with the printenv Command

Use the printenv command, found under the /usr/bin directory, to print the value of a particular variable, or a list of currently defined environment variables, like so:

$ printenv SHELL
/bin/bash
$ printenv
USERNAME=
ENV=/home/bball/.bashrc
BROWSER=/usr/local/bin/netscape
HISTSIZE=1000
HOSTNAME=localhost.localdomain
LOGNAME=bball
HISTFILESIZE=1000
MAIL=/var/spool/mail/bball
HOSTTYPE=i386
PATH=/usr/local/bin:/bin:/usr/bin:.:/usr/sbin:/sbin:/usr/X11R6/bin:
\ /usr/local/bin:/usr/bin/mh:/home/bball/bin
HOME=/root
SHELL=/bin/bash
USER=bball
HOSTDISPLAY=localhost.localdomain:0.0
DISPLAY=:0.0
OSTYPE=Linux
NNTPSERVER=news.staffnet.com
SHLVL=5
EDITOR=/usr/bin/pico

Not all the environment variables ...

Get Practical Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.