What is this $PATH in Linux and how to modify it -


i have few questions on $path in linux.

i know tells shell directories search executable files, so:

  1. what mean environmental variable?
  2. how change path? , recommended change it?
  3. if change consequences?

to path current $path variable type in:

echo $path  

it tells shell binaries.

yes, can change - example add $path folder custom scripts.

so: if scripts in /usr/local/myscripts execute them have type in full path script: /usr/local/myscripts/myscript.sh after changing $path variable can type in myscript.sh execute script.

here example of $path rhel:

/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/user/bin

to change $path have either edit ~/.profile (or ~/.bash_profile) user or global $path setting in /etc/profile.

one of consequences of having inaccurate $path variables shell not able find , execute programs without full $path.


Comments