Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Environment Variables

Linux has lots of variables in your default environment.  Variables in Linux start with a '$' and, by convention, they frequently use capital letters (but that is not required).  You can also create variables in Linux to use later, which is a convenient trick that we will use.  Try the following commands:

List all the variables currently in your environment:

env

Print the "HOME" variable to see what it contains:

echo $HOME

Notice that you have to use a $ for an existing variable!

What do you think the WORK variable contains?

Try this:

cd $WORK

pwd

cd $HOME

pwd

HOME and WORK are "convenience variables" because they are short, easy to remember, and faster than typing out the full directory structure.

  • No labels