I’ll spoil it – “printenv” is your friend. This guide will show a few examples of how to use it.
printenv
This will print something like this:
...
rvm_bin_path=/Users/josephtyler/.rvm/bin
VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
VIRTUALENVWRAPPER_PROJECT_FILENAME=.project
TERM_PROGRAM=Apple_Terminal
GEM_HOME=/Users/josephtyler/.rvm/gems/ruby-2.2.0
SHELL=/bin/bash
...
This is a list of environment variable keys and values. There is one key/value pair per line.Still using printenv if you specify a name, then the value is printed (supposing it exists).
printenv RUBY_VERSION
will simply print:
ruby-2.2.0I’ll spoil it – “printenv” is your friend. This guide will show a few examples of how to use it.
printenv
This will print something like this:
...
rvm_bin_path=/Users/josephtyler/.rvm/bin
VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
VIRTUALENVWRAPPER_PROJECT_FILENAME=.project
TERM_PROGRAM=Apple_Terminal
GEM_HOME=/Users/josephtyler/.rvm/gems/ruby-2.2.0
SHELL=/bin/bash
...
This is a list of environment variable keys and values. There is one key/value pair per line.Still using printenv if you specify a name, then the value is printed (supposing it exists).
printenv RUBY_VERSION
will simply print:
ruby-2.2.0I’ll spoil it – “printenv” is your friend. This guide will show a few examples of how to use it.
printenv
This will print something like this:
...
rvm_bin_path=/Users/josephtyler/.rvm/bin
VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
VIRTUALENVWRAPPER_PROJECT_FILENAME=.project
TERM_PROGRAM=Apple_Terminal
GEM_HOME=/Users/josephtyler/.rvm/gems/ruby-2.2.0
SHELL=/bin/bash
...
This is a list of environment variable keys and values. There is one key/value pair per line.Still using printenv if you specify a name, then the value is printed (supposing it exists).
printenv RUBY_VERSION
will simply print:
ruby-2.2.0I’ll spoil it – “printenv” is your friend. This guide will show a few examples of how to use it.
How to Print Environment Variables in Linux/Unix
webdevlinuxunixprintenv
This will print something like this:
...
rvm_bin_path=/Users/josephtyler/.rvm/bin
VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
VIRTUALENVWRAPPER_PROJECT_FILENAME=.project
TERM_PROGRAM=Apple_Terminal
GEM_HOME=/Users/josephtyler/.rvm/gems/ruby-2.2.0
SHELL=/bin/bash
...
This is a list of environment variable keys and values. There is one key/value pair per line.Still using printenv if you specify a name, then the value is printed (supposing it exists).
printenv RUBY_VERSION
will simply print:
ruby-2.2.0printenv
This will print something like this:
...
rvm_bin_path=/Users/josephtyler/.rvm/bin
VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
VIRTUALENVWRAPPER_PROJECT_FILENAME=.project
TERM_PROGRAM=Apple_Terminal
GEM_HOME=/Users/josephtyler/.rvm/gems/ruby-2.2.0
SHELL=/bin/bash
...
This is a list of environment variable keys and values. There is one key/value pair per line.printenv
This will print something like this:
...
rvm_bin_path=/Users/josephtyler/.rvm/bin
VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
VIRTUALENVWRAPPER_PROJECT_FILENAME=.project
TERM_PROGRAM=Apple_Terminal
GEM_HOME=/Users/josephtyler/.rvm/gems/ruby-2.2.0
SHELL=/bin/bash
...
This is a list of environment variable keys and values. There is one key/value pair per line.Use printenv to print all environment variables
Still using printenv if you specify a name, then the value is printed (supposing it exists).
printenv RUBY_VERSION
will simply print:
ruby-2.2.0Still using printenv if you specify a name, then the value is printed (supposing it exists).
printenv RUBY_VERSION
will simply print:
ruby-2.2.0If a name is specified, only its value is printed




Want to support Howchoo? When you buy a tool or material through one of our Amazon links, we earn a small commission as an Amazon Associate.



