How can I set shell environment variables in linux? I've got FC 5 but I also want a general config file or a command.

Recommended Answers

All 4 Replies

/etc/profile for "world" wide variables. The basic PATH and sometimes TMOUT is usually set here.

.bashrc or .profile for a given user or yourself.
Edit the file and add something like:

export MYVAR="SOME VALUE"

Save the file, then source it

source .bashrc 
# or
source .profile

That what you mean?

You can also set a variable temporarily by just going:
MYVAR="something"
The variable will be reset as soon as you reboot/restart.

/etc/profile is something like a bash script. Can you guide me where exactly to put the statement you mentioned?

/etc/profile is something like a bash script. Can you guide me where exactly to put the statement you mentioned?

You should see a lot (or a few) paths seperated by colons. Place the path you want to at the end, prefixed by a colon.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.