Learn to pass environment variables to processes at the Linux command line.
Linux export command summary with examples (3:37)
Videos can also be accessed from the YouTube Playlist.
Our forty-seventh word, or command to memorize is
export from our category
export allows you to pass
environment variables to other processes.
Recall from the last video, we viewed and edited an environment variable. Now we'll learn how to set and share one.
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s).
export command has
only 3 options and the argument is the variable
to set for use in other processes, run outside the shell.
Unlike most commands, help is not available with double-dash
--help and the
-p option is helpful to list all
So why is
export an important command?
Well, especially as we advance, we may collect and pass variables to
be used outside the local
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go. Recall from video 46, we used
printenv but stopped short of
actually establishing environment variables. Let's work on that and
create an environment variable called BBTEAM for
baseball team and input my favorite team, the San Francisco Giants.
Next, I can use
echo to see if it
worked by using
$BBTEAM, and the
$ is required because
it's a variable.
So far so good.
printenv BBTEAM. Did the
BBTEAM environment variable stick?
Now for the whole reason for this video, type
And then last, verify by trying the
printenv BBTEAM again.
And very good.
Okay now you know how to use
And you know the syntax for commands, options and arguments.
One last tip about the
So if you can't find a manual page for
export you're not alone. It's a
shell builtin for
bash, so you'll find
information in the very long manual page for
bash. If you're curious.
Okay, thanks for visiting today. I hope this was a helpful
introduction to the
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
Subscribe to our YouTube Channel to learn more.
printenvcommand, hit Back.
set, click Next.