How do I set environment variables in my shell?

Updated -

In order to set environment variables you have to use the specific command for the shell which you are using. If you wish to figure out which shell you are in you can issue the command echo $SHELL as shown below:

# echo $SHELL

Below is a table and the correct command and syntax for some of the more popular shells.

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content