How to print the current environment variables in the Linux shell.

To print a listing of all environment variables in the Linux terminal or VT, use the printenv command, this prints the environment to the terminal. deusexmachina:~ jason$ printenv TERM_PROGRAM=Apple_Terminal SHELL=/bin/bash TERM=xterm-256color TMPDIR=/var/folders/8n/777bpxj118j6690m3s7lypqw0000gn/T/ Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.zKtQPi5TVv/Render TERM_PROGRAM_VERSION=421.1 TERM_SESSION_ID=6D73ABAB-FA6D-4AEF-9885-768BC4D18F9B USER=jason SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.19fMX85EE3/Listeners PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Applications/Wireshark.app/Contents/MacOS PWD=/Users/jason LANG=en_AU.UTF-8 XPC_FLAGS=0x0 XPC_SERVICE_NAME=0 SHLVL=1 HOME=/Users/jason LOGNAME=jason _=/usr/bin/printenvdeusexmachina:~ jason$ printenv TERM_PROGRAM=Apple_Terminal SHELL=/bin/bash TERM=xterm-256color TMPDIR=/var/folders/8n/777bpxj118j6690m3s7lypqw0000gn/T/ Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.zKtQPi5TVv/Render TERM_PROGRAM_VERSION=421.1 … Read more

How to manipulate environment variables with the bash shell on Linux.

Manipulating environment variables in the bash shell is very useful indeed, this shows a few examples. This uses the feature of the Linux shell called parameter expansion. This replaces the name of an environment variable with it`s contents when echoed to the shell. These few examples show how the content echoed to the terminal may … Read more