jQuery in Action, 3rd edition
The moose likes Linux / UNIX and the fly likes Editing Environment Variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Editing Environment Variables" Watch "Editing Environment Variables" New topic

Editing Environment Variables

Brian Smith
Ranch Hand

Joined: Oct 26, 2002
Posts: 232
Hi Folks,
I am new to Linux world. When i type env, it shows bunch of environment variables and some of them are not what i would like. somehow i messed up those variables' values but i don't know which file i should open to get an access to those variables and edit those values. could you please help with this? thanks.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

A lot of files might be responsible.
Because linux is a networking system, there are setup-files for the whole system, as well as per user.

The system-specific ones are normally in /etc/XY[rc] - the user specific files in /home/carn/.XY[rc]
Not all files end on ...rc especially /etc/profile and /home/carn/.bashprofile.

If you search for the env-setting LC_TIME, I would use grep or find:

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

Careful, you could make the whole OS break down. Unless it's already been corrupted, you probably should be content with overriding them as needed. For example, say I want to work with Java 5, but everyone else is still on JDK 1.4, so I want to override the path and JAVA_HOME (or on my servers, add them, since they're not standard OS settings). The best place for me to do than on a RedHat/Fedora system is in /home/timh/.bash_profile. Just set and export JAVA_HOME and update exported PATH=$JAVA_HOME/bin:$PATH.

How environment variables get set is largely a matter of where you are and how that particular distro manages that part of the system. The only real way to tell - unless there's documentation for your distro - is to manually trace the process. Certain key files are /etc/profile, /etc/skel (where prototype profiles for newly added users are defined), and the $HOME profile file(s) used for the shell you're running. For their names, consult the man pages for your shell of choice.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link: http://aspose.com/file-tools
subject: Editing Environment Variables
It's not a secret anymore!