EnvironmentalVariables: Difference between revisions
(Created page with "In UNIX and Windows many of the commands run have variables that are parsed from a users environment. These can be set in many ways but we will cover the most popular [[tcsh]...") |
No edit summary |
||
Line 1: | Line 1: | ||
In UNIX and Windows many of the commands run have variables that are parsed from a users environment. These can be set in many ways but we will cover the most popular [[tcsh]] and [[bash]]. | In UNIX and Windows many of the commands run have variables that are parsed from a users environment. These can be set in many ways but we will cover the most popular [[tcsh]] and [[bash]]. | ||
==PATH== | ==PATH(Unix)== | ||
The most common variable is the PATH variable, this will add additional paths to search for programs to be run from the command line. You can see your PATH variable by using the built in echo command in the shell. When printing out environment variables you will need to prefix the variable with the $ sign. | The most common variable is the PATH variable, this will add additional paths to search for programs to be run from the command line. You can see your PATH variable by using the built in echo command in the shell. When printing out environment variables you will need to prefix the variable with the $ sign. | ||
Line 19: | Line 19: | ||
These can be either typed into your shell directly or added to your shells initialization files so every time you spawn a shell it will get this new PATH. | These can be either typed into your shell directly or added to your shells initialization files so every time you spawn a shell it will get this new PATH. | ||
== | ==PATH(Windows)== | ||
To modify the Windows PATH Environmental Variable do the following: | |||
# Right-click Computer, and then click Properties. | |||
# Click on Advanced system settings. | |||
# Select the Advanced Tab | |||
# Click Environment variables. | |||
# Under User Variables for <username> choose the PATH Variable. | |||
## If there is none Click New and put PATH for the variable Name. | |||
# Click Edit and append the location you are trying to add. Different paths are separated by semicolons. | |||
To verify that the PATH variable has been modified properly do the following: | |||
# Open a new Command Prompt (Start -> Accessories -> Command Prompt). | |||
# Type in PATH | |||
The updated PATH should be printed. |
Revision as of 19:47, 24 April 2013
In UNIX and Windows many of the commands run have variables that are parsed from a users environment. These can be set in many ways but we will cover the most popular tcsh and bash.
PATH(Unix)
The most common variable is the PATH variable, this will add additional paths to search for programs to be run from the command line. You can see your PATH variable by using the built in echo command in the shell. When printing out environment variables you will need to prefix the variable with the $ sign.
# echo $PATH /usr/kerberos/bin:/opt/condor-7.0.5/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
In almost all cases you will want to append to either the beginning or end of your PATH variable and not replace it fully as this will most likely decrease the functionality of your shell. For example if you wanted to add the path /opt/UMtorque/bin to the end of your PATH then you could do the following,
- tcsh/csh
- setenv PATH ${PATH}:/opt/UMtorque/bin
- bash/sh
- export PATH=${PATH}:/opt/UMtorque/bin
These can be either typed into your shell directly or added to your shells initialization files so every time you spawn a shell it will get this new PATH.
PATH(Windows)
To modify the Windows PATH Environmental Variable do the following:
- Right-click Computer, and then click Properties.
- Click on Advanced system settings.
- Select the Advanced Tab
- Click Environment variables.
- Under User Variables for <username> choose the PATH Variable.
- If there is none Click New and put PATH for the variable Name.
- Click Edit and append the location you are trying to add. Different paths are separated by semicolons.
To verify that the PATH variable has been modified properly do the following:
- Open a new Command Prompt (Start -> Accessories -> Command Prompt).
- Type in PATH
The updated PATH should be printed.