Wayne State University


Wayne State University

High Performance Computing Services


Download this cheatsheet for basic commands to use in ViM which is used for text editing.
VI Editor Cheatsheet
This tutorial shows how to modify environment variables in the bash shell. Environment variables are values that affect the behavior of computer processes.
The env command allows the user to see what the current settings are for environment variables.

  Input: env

  Result: Variable Settings
Login on the Grid.
First, modify your $PATH.
Examine your path. # echo $PATH

  Input: echo $PATH

The path will be displayed.

  Result: Path address
Check all the contents of your home directory, including the hidden ones. # ls -al

  Input and result: ls -al
Select the directory you want to change you PATH results to. (In this example we will change it to Hello. The directory 'Hello' in the users home directory will be part of their path. Remember that this is based off your directory's and not the one in the example.)

# PATH=$PATH:/wsu/home/xx/xx12/xx1234/Hello ; export PATH

  Input: PATH=$PATH:/wsu/home/xx/xx12/xx1234/Hello
Check your path to see the change. # echo $PATH

  Input: echo $PATH
Your PATH will reset each time you logon. To change it permanently, use VIM to edit the .bash_profile (this is a hidden file in your directory). # vim .bash_profile

  Input: vim .bash_profile

You should see a screen like this:

  .bash_profile in vim editor
Change the portion under '# User specific environment and startup programs' to 'PATH=$PATH:/wsu/home/xx/xx12/xx1234/Hello ; export PATH'

  .bash_profile in vim editor
Save changes and quit. # :wq

  .bash_profile in vim editor. Save: wq
Your path should now be permanently modified.

  Exiting vim editor
Next, here is a simple example of modifying an environment variable. We will call this variable HELLO_WORLD
The name of this environment variable will be HELLO_WORLD.

export HELLO_WORLD=Hello_world_I_use_the_grid

  Input: export HELLO_WORLD=Hello_world_I_use_the_grid
Check to see the result.


  Input: echo $HELLO_WORLD
The results will display.

  Results: Hello_world_I_use_the_grid
List of Environment Variables
LD_LIBRARY_PATHtells the system where to find shared libraies that are needed
HOMEthe path of the home directory
USERthe login name of the user
Computer Center Services * 5925 Woodward Avenue Detroit, Michigan 48202