|Linux| environment path and priority

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.

  1. export command:
    export PATH=”$PATH”:/home/bin
    or
    export PATH=${PATH}:/home/bin
    ** need to reboot
  2. modify profile:
    add
    export PATH=”$PATH”:/home/bin
     or
    export PATH=${PATH}:/home/bin
    in “/etc/profile”
    ** need to reboot
  3. modify .bashrc:
    add
    export PATH=”$PATH”:/home/bin
     or
    export PATH=${PATH}:/home/bin
    ** need to reopen your terminal
  4. 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