Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-20-2008, 05:10 PM   #1
Registered: Mar 2008
Posts: 52

Rep: Reputation: 15
Environment Variable

It seems as a simple question for u , how can we set an environment variable ?
many thanks in advance
Old 03-20-2008, 05:17 PM   #2
LQ Guru
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 62
Which environment variable are you referring to?
Usually use the export command.

Old 03-20-2008, 05:18 PM   #3
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975

was that simple enough? maybe you actually mean something you're not asking? how to make it globally accessible on boot? add it to /etc/rc.local as "export variable=value" and once booted that variable will be everywhere.
Old 03-20-2008, 05:21 PM   #4
LQ Guru
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Debian 8
Posts: 7,860

Rep: Reputation: 311Reputation: 311Reputation: 311Reputation: 311
Originally Posted by linux_linux View Post

It seems as a simple question for u , how can we set an environment variable ?
many thanks in advance
You set an environment variable from the command line using an = sign. For example:


both creates KLMNO and sets the value of KLMNO to 123456. If you want to know the current values of your existing environment variables use this command:


You can find out the value of an individual environment variable with the echo command:

echo $KLMNO

Steve Stites
Old 03-20-2008, 10:16 PM   #5
Registered: Mar 2008
Posts: 101

Rep: Reputation: 15
It can be done by simple substitution, export or adding in your .profile.

Fedora Development

Last edited by prad77; 04-17-2008 at 03:18 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Environment variable vedanu Programming 1 05-17-2007 07:20 AM
Environment variable.. manomohan Programming 1 02-26-2007 11:27 PM
environment variable gamor Linux - Newbie 4 04-30-2005 05:28 PM
environment variable mimi Linux - Newbie 1 04-10-2002 08:29 AM
environment variable mimi Linux - General 2 04-10-2002 07:45 AM

All times are GMT -5. The time now is 09:53 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration