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

How to Print Environment Variables in Linux/Unix

Tyler Tyler (285)
Total time: 2 minutes 
Updated: July 22nd, 2020

I’ll spoil it – “printenv” is your friend. This guide will show a few examples of how to use it.

Posted in these interests:

webdev
PRIMARY
58 guides
linux
41 guides
unix
13 guides

How to Print Environment Variables in Linux/Unix

webdevlinuxunix
Tyler Tyler (285)
Total time: 2 minutes 
Updated: July 22nd, 2020
Tyler
1
 

Posted in these interests:

webdev
PRIMARY
58 guides
linux
41 guides
unix
13 guides
webdev
PRIMARY
58 guides
linux
41 guides
unix
13 guides
PRIMARY
Calling all writers!

We’re hiring. Write for Howchoo

1
 
In these interests
webdev
PRIMARY
58 guides
linux
41 guides
unix
13 guides
webdev
PRIMARY
58 guides
linux
41 guides
unix
13 guides
PRIMARY
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.0
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.
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.0

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

If a name is specified, only its value is printed

Calling all writers!

We’re hiring. Write for Howchoo

Tyler's profile pictureTyler
Joined in 2015
Software Engineer and creator of howchoo.
Tyler's profile picture
Share this guide!
RedditEmailText
Related to this guide:
MySQL vs PostgreSQLMySQL vs PostgreSQL
Comparing performance, syntax, replication, and features.
Gilad's profile picture GiladView
In these interests: postgresqlwebdevmysql
How to export clean HTML from Google DocsHow to export clean HTML from Google Docs
By default, the HTML exported from Google Docs includes tons of classes, styles, and is generally messy. This short guide will teach you how to export clean HTML devoid of classes and inline styles.
Zach's profile picture ZachView
In these interests: googledocswebdevcode
Filtering Google Analytics language spamFiltering Google Analytics language spam
Google Analytics spam is nothing new. But now spammers have realized that, since language appears in the initial Google Analytics dashboard view, spoofing the language code reaches eyeballs.
Zach's profile picture ZachView
In these interests: webdev
MySQL vs PostgreSQLMySQL vs PostgreSQL
Comparing performance, syntax, replication, and features.
Gilad's profile picture GiladView
In these interests: postgresqlwebdevmysql
Gilad's profile pictureViewpostgresqlwebdevmysql
How to export clean HTML from Google DocsHow to export clean HTML from Google Docs
By default, the HTML exported from Google Docs includes tons of classes, styles, and is generally messy. This short guide will teach you how to export clean HTML devoid of classes and inline styles.
Zach's profile picture ZachView
In these interests: googledocswebdevcode
Zach's profile pictureViewgoogledocswebdevcode
Filtering Google Analytics language spamFiltering Google Analytics language spam
Google Analytics spam is nothing new. But now spammers have realized that, since language appears in the initial Google Analytics dashboard view, spoofing the language code reaches eyeballs.
Zach's profile picture ZachView
In these interests: webdev
Zach's profile pictureViewwebdev
People also read:
Converting XML files to JSON is a good practice for providing easy manipulation and preparing service responses. You can accomplish this efficiently with just three lines of code.
Part of being a web developer is testing things that will inevitably break in insane and unexpected ways in Internet Explorer.
As a developer, I’ve customized my bash prompt to always show the current git branch if I’m in an initialized git repository. This is convenient, but it can make for a very long bash prompt.
This guide will show you how to set up a LAMP environment in macOS and OS X.
Surprisingly, normal YouTube embeds are not automatically sized to the browser window as it is resized.
I started programming in PHP, so by default I would use apache even when I just wanted to test basic HTML files. As I was learning Python, I discovered a great HTTP request handler.
As a web developer, I stare at Chrome’s developer tools — particularly the Elements and Console tabs — all day long. As a result, all light and no dark makes Zach’s eyes dull and tired.
You can echo the current MODX resource’s full page URL without the use of a snippet call.
Renaming a MySQL table is very simple, but sometimes the syntax is hard to remember.
Converting XML files to JSON is a good practice for providing easy manipulation and preparing service responses. You can accomplish this efficiently with just three lines of code.
Part of being a web developer is testing things that will inevitably break in insane and unexpected ways in Internet Explorer.
As a developer, I’ve customized my bash prompt to always show the current git branch if I’m in an initialized git repository. This is convenient, but it can make for a very long bash prompt.
This guide will show you how to set up a LAMP environment in macOS and OS X.
How to Convert XML to JSON in PHP
How to Run Internet Explorer on Mac (For Free)
Adjust the Length of Your Bash Prompt on the Fly
How to Set Up a LAMP server in macOS
GitHub Pull Requests: How and Why to Use Pull Requests
Surprisingly, normal YouTube embeds are not automatically sized to the browser window as it is resized.
I started programming in PHP, so by default I would use apache even when I just wanted to test basic HTML files. As I was learning Python, I discovered a great HTTP request handler.
As a web developer, I stare at Chrome’s developer tools — particularly the Elements and Console tabs — all day long. As a result, all light and no dark makes Zach’s eyes dull and tired.
You can echo the current MODX resource’s full page URL without the use of a snippet call.
Renaming a MySQL table is very simple, but sometimes the syntax is hard to remember.
Make YouTube Video Embeds Responsive Using Pure HTML and CSS
Using Python’s simple HTTP server
Tell Chrome Developer Tools to Use a Dark Theme
How to Print the Current Page URL in MODX
Rename a MySQL table
Posted in these interests:
webdevwebdev
webdev
PRIMARY
All things web development.
webdevwebdev
webdev
PRIMARY
All things web development.
PRIMARY
ExploreExploreExplore
Discuss this guide:
We’re hiring!
Are you a passionate writer? We want to hear from you!
We’re hiring!
Are you a passionate writer? We want to hear from you!
View openings

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.

Donate

Leave a Reply

Your email address will not be published. Required fields are marked *