Environments for shells
Essentially, anything that runs processes will tend to read a configuration file on starting up, and to affect the environment of that, you need to hit its configuration file.
For user shells, "obvious" places are .profile
, .bashrc
, .bash_profile
(I think) and maybe a couple of others I don't remember. Obviously, more and others if you use zsh
, csh
, tcsh
or whatever as a shell.
There are initialization files read by your windowing environment, which may be either KDE or Gnome. The particular window manager you run underneath that may also read a config file. I admit I don't know the names of those files even for my own installation.
Finally, there are usually "master" configuration files for all those environments somewhere in /etc
. They provide defaults for stuff the users don't.
I think that programs that install themselves conscientiously check the various possibilities. Various Linux distributions may offer some helper scripts for this.
cron
This one is a lot easier. For security reasons, cron
only passes a couple of environment variables to subprocesses, ALWAYS. I think USER
is one of those, and MAILTO
another. As far as I know, there's no PATH
set - this often annoys newbies. The environment of a cron job is completely different from your shell environment! Anything you want in the environment, you either pass in on the command line in crontab
, or you start up a script and let that set up whatever environment it needs.