Setting Environment variable in Linux

March 5, 2009 at 11:10 AM | Posted in Linux | 2 Comments

The following setting is for FC8 Linux. The file name or path may change for different flavor of Linux
For system wide effect , edit /etc/bashrc file and for particular user edit file home/<username>/.bash_profile and add your environment variable. For example, adding JAVA_HOME variable
#export JAVA_HOME=/usr/bin
Then save the file and run it using source command.
#source /etc/bashrc or source /home//.bash_profile
You can test it by
echo $<your_variable_name>

2 Comments »

RSS feed for comments on this post. TrackBack URI

  1. Adding few things here -
    1. To set environment variable in csh use setenv and for bash, use export. For ex -
    setenv JAVA_HOME “/usr/bin”
    export JAVA_HOME=”/usr/bin”

    2. When sourced the file, you may not see the changes in current shell. Open a new shell to changes to take place.

    • Good one dear…waiting for more reply….


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 )

Connecting to %s

Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.

Follow

Get every new post delivered to your Inbox.