Skip to content

Linux Environment Variables

August 9, 2012

What are Environment Variables

Like global variables in a program Environment Variables are a set of variables whose values can affect the way running behave in a system.

Some Important Environment Variables

  • HOME – The home directory of the current user
  • PATH – The list of directories to search through when looking for commands (i.e. java, apachectl)
  • TEMP – location where processes can store temporary files

How to get Environment Variables

View All Variables
$ env
View Single Variables
$ echo $HOME

How to set Environment Variables

#Setting a path
$ export My_PATH = /some/path/here

#Setting a string
$ export My_NAME = "My Name Here"

#Setting a path using an existing environment variables
$ export My_OTHER_PATH = $HOME/some/other/path/here

Useful Links

http://en.wikipedia.org/wiki/Environment_variables

http://lowfatlinux.com/linux-environment-variables.html

Advertisements

From → Guide

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: