Skip to content

Environment variables

mpsaloha edited this page Jul 25, 2014 · 6 revisions

The value of many ENVIRONMENT VARIABLES can be determined by issuing the "env" command on Mac OSX or Linux command line. Also some important variables can be changed using the "set" command from the command line (or by placing them in a script, like a .bashrc file; and then issuing "source .bashrc")

  • It is a bit harder to assess and modify ENVIRONMENT VARIABLES on Windows--

  • On Windows 8, use the GUI: Start -> All Apps -> Control panel -> System -> Advanced System Settings -> Advanced tab -> Environment variables

  • On Windows 7, use the GUI: Right-click Computer -> Properties -> Advanced system settings -> Advanced tab -> Environment Variables

  • On Windows XP, use the GUI: Right-click My Computer -> Properties -> Advanced tab -> Environment Variables

  • There are short-cuts and other ways to do this on Windows, but these are more esoteric since Windows tries to make things easy and intuitive via its GUI (that's the party line anyway).

One of the most common reasons for needing to check your ENVIRONMENT VARIABLES is to see whether some executable or command is in your PATH. When you type a command on the command line, and it doesn't execute, there are two main reasons why nothing might happen. First, the directory in which the command is found is not included in your PATH. That is, you might need to modify your PATH to pick up that command. Second-- the command is not set to EXECUTABLE. To make a command executable, you must set its access permissions:

  • chmod u+x command-name (for Linux or OSX)
  • in Windows, executability is indicated by a filename extension of ".com" or ".exe", or, at least in the old days, by the "bat" extension.
  • in both cases above, for a command to be executed, it must be in your PATH