O'Reilly logo

Practical Linux by Bill Ball, John Ray, Michael Turner, M. Drew Streib

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required