Il percorso dove andare a pescare i programmi viene determinato dalla variabile d'ambiente PATH (dai 'echo $PATH'). Per capire come viene settata questa variabile e da chi, eventualmente viene modificata, leggi il manuale della bash, dove, all'inizio, cita:
bash(1) ha scritto: When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.
When a login shell exits, bash reads and executes commands from the file ~/.bash_logout, if it exists.
When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file exists. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of ~/.bashrc.
Le shell di login sono quelle generalmente invocate al tuo login, ma più in generale:
bash(1) ha scritto:A login shell is one whose first character of argument zero is a -, or one started with the --login option.
Le shell interattive invece sono, ad esempio, quelle che hai nei terminali virtuali sotto X:
bash(1) ha scritto: An interactive shell is one started without non-option arguments and without the -c option whose standard input and error are both connected to terminals (as determined by isatty(3)), or one started with the -i option. PS1 is set and $- includes i if bash is interactive, allowing a shell script or a startup file to test this state.
Per finire, il comando 'source', sempre dal man della bash:
- Codice: Seleziona tutto
source filename [arguments]
Read and execute commands from filename in the current shell
environment and return the exit status of the last command
executed from filename. If filename does not contain a slash,
file names in PATH are used to find the directory containing
filename. The file searched for in PATH need not be executable.
When bash is not in posix mode, the current directory is searched
if no file is found in PATH. If the sourcepath option to the
shopt builtin command is turned off, the PATH is not searched.
If any arguments are supplied, they become the positional parameters
when filename is executed. Otherwise the positional parameters
are unchanged. The return status is the status of the last command
exited within the script (0 if no commands are executed), and
false if filename is not found or cannot be read.
Quante cose ci dice un manuale

,
Emanuele