This tutorial is still about creating environment variables, just like my last tutorial. But now I create environment variable in Linux, not Windows.

To create or edit environment variable in linux is very easy. You may create or edit environment variable from terminal.

The syntax is: export VAR_NAME=var_content

For example:

export JAVA_HOME=/usr/lib/jvm/sun-java6

Yes, very easy right? If you want to append content to an existing variable, you can’t use command above. Command above will create a new variable, not append it. To append content, you may use command below.

The syntax is: export VAR_NAME=$VAR_NAME:var_content

For example:

export PATH=$PATH:/usr/lib/jvm/sun-java6/bin

or, if you have created JAVA_HOME variable, you may use command below:

export PATH=$PATH:$JAVA_HOME/bin

Easy right?

Note:
To define a variable, you don’t need ‘$‘ character. But when you use it (for example when you append variable content), don’t forget ‘$‘ character.

Related posts:

  1. How to Create Environment Variables in Windows
  2. How To Install Java in Linux Ubuntu
  3. Who’s Accessing Your Linux Box?
  4. Send Message Over Linux Console
  5. Checking Disk Capacity in Linux

Tags: ,

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>