Other Environment Variables

Ubuntu also provides many other environment variables; some of the more common ones are listed in Table 7-3.

Table 7-3. Common environment variables

Environment variable

Contents

HOME

Your home folder

LANG

The default language

MANPATH

The path to the man program’s manual pages

PATH

The system path

PWD

The current working directory

SHELL

The current shell

TZ

The time zone

USER

Your username

Each variable’s contents can be displayed using the echo command, like this:

echo $HOME

Note

Most commands require you to preface variables with a $ sign to let the operating system know that you are referring to a variable and not just a string of letters.

You can also use environment variables in paths, so you could list the contents of the Documents folder within your home folder using this command:

ls $HOME/Documents

As you can see, $HOME and the ~ operator are interchangeable.

Get Ubuntu: Up and Running now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.