Last week, I help my colleague to solve a path problem.
About Priority, if you execute
$ echo $PATH
The priority is decreasing from the left to the right.
About Setting files:
there are 4 places can set the path.
- export command:
export PATH=”$PATH”:/home/bin
or
export PATH=${PATH}:/home/bin
** need to reboot - modify profile:
add
export PATH=”$PATH”:/home/bin
or
export PATH=${PATH}:/home/bin
in “/etc/profile”
** need to reboot - modify .bashrc:
add
export PATH=”$PATH”:/home/bin
or
export PATH=${PATH}:/home/bin
** need to reopen your terminal - modify /etc/enviroment:
add in the last
PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin”
** need to reboot
About loading sequence:
/etc/profile/ —> /etc/paths —> /etc/bashrc
—> ~/.bash_profile or ~/.bashrc —> ~/.bash_login —> ~/.bash_profile
System level:
/etc/profile, /etc/paths, /etc/bashrc