Linux Environmental Variables

Linux shells use system- and user-defined variables (called environmental variables). The values for these variables are accessed using a "$" followed by the variable name. The variable name can either be placed inside { }'s (e.g., ${HOME}) or left un-delimited (e.g., $HOME). In some cases, leaving out the delimiting { }'s can result in an ambiguous statement, and using them is strongly suggested. Also keep in mind that linux is case sensitive and that ${HOME} could mean something completely different from ${home}!

Most linux shells will interpret the set command to show the name and value of all the shell variables that are active (set), along with a number of other system- and user-defined things. If you want to see your environmental variables, simply type set at the command prompt.

Here are some useful environmental variables, starting with fixed, system-defined variables and ending with a few set by the cryoem Modules environment:

Variable Explanation
USER

the user name for whoever is running the current shell

HOSTNAME

the name of the computer your are logged onto

HOME

where in the computer system you are immediately after logging onto the system; for users of Karst, your home area will be something like /N/u/yourUserName/Karst

SHELL

which shell you use immediately after logging on; keep in mind that you can change the shell you are using within any session on the computer, but that you always have a particular shell defined as your "default shell" (the one you run immediately after logging onto the system, which is the one defined by SHELL...)

PROMPT_COMMAND

describes the information available in your command prompt; for example, while some linux systems are set to show a simple "$" as the prompt, others will show things like your user name, the computer's name, the current time and date, the full path to the current directory, only the name of the current directory, or any combination of all these

LOADEDMODULES

this variable is created by the Modules system and holds the list of modules that are currently loaded; this will change when you load and/or unload modules using the module command

PATH

a list of places where various commands and programs reside; you can also think about this simply as the path to these commands and programs; when you type a command or a program name, this path is searched until either the command/program is found or until the end of the path is reached (in which case, you will receive an error that indicates the command/program can not be found); PATH is manipulated by the Modules system (and you can manually manipulate it if you are careful!)

LD_LIBRARY_PATH

another path, this time to places where various libraries (also called "archives") are stored; specific libraries are needed when certain programs are run, and if this path does not allow you to find the library a program needs, the program cannot run; this variable is also manipulated by the Modules system

PWD

the current location (see the section on commands for the etymology of PWD); this variable obviously changes as you move around the computer system

OLDPWD

the location immediately prior to your current location; this variable also obviously changes as you move around the system; if you have not yet moved from your home area, this variable is empty (or "not set")

CRYO_PREFIX

the location of all the software that is accessed when the cryoem module is loaded

EMAN2DIR

the topmost location for everything needed to run the EMAN2 programs

 

NOTE: to learn the value of any variable, simply type

echo ${variableName}