This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Editing Environment Variables

 
Brian Smith
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18272
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic