Skip to main content
replaced http://serverfault.com/ with https://serverfault.com/
Source Link

1. What is the purpose of PATH?

PATH is an environment variable that contains a colon-separated list of directories where your shell will look for executables that you name on the command line without providing an explicit path to them (as in your jsdoc example). Thus, if your PATH has

/usr/bin:/bin:/home/bin 

then any executable you call by name will be searched for in these directories (in that order) and the first executable found is the one executed.

2. What is the difference between /etc/paths and ~/.bash_profile

According to this question on ServerFaultthis question on ServerFault, /etc/paths is used to set PATH globally (i.e. system-wide, for all users) while ~/.bash_profile is used to set per-user preferences (where ~ will be the user's home directory). What is written in .bash_profile can either add to the global PATH from /etc/paths or override it completely.

For the record, /etc/paths seems to be a MAC OS peculiarity: I haven't come across it on GNU/Linux, at least.

1. What is the purpose of PATH?

PATH is an environment variable that contains a colon-separated list of directories where your shell will look for executables that you name on the command line without providing an explicit path to them (as in your jsdoc example). Thus, if your PATH has

/usr/bin:/bin:/home/bin 

then any executable you call by name will be searched for in these directories (in that order) and the first executable found is the one executed.

2. What is the difference between /etc/paths and ~/.bash_profile

According to this question on ServerFault, /etc/paths is used to set PATH globally (i.e. system-wide, for all users) while ~/.bash_profile is used to set per-user preferences (where ~ will be the user's home directory). What is written in .bash_profile can either add to the global PATH from /etc/paths or override it completely.

For the record, /etc/paths seems to be a MAC OS peculiarity: I haven't come across it on GNU/Linux, at least.

1. What is the purpose of PATH?

PATH is an environment variable that contains a colon-separated list of directories where your shell will look for executables that you name on the command line without providing an explicit path to them (as in your jsdoc example). Thus, if your PATH has

/usr/bin:/bin:/home/bin 

then any executable you call by name will be searched for in these directories (in that order) and the first executable found is the one executed.

2. What is the difference between /etc/paths and ~/.bash_profile

According to this question on ServerFault, /etc/paths is used to set PATH globally (i.e. system-wide, for all users) while ~/.bash_profile is used to set per-user preferences (where ~ will be the user's home directory). What is written in .bash_profile can either add to the global PATH from /etc/paths or override it completely.

For the record, /etc/paths seems to be a MAC OS peculiarity: I haven't come across it on GNU/Linux, at least.

Source Link
Joseph R.
  • 40.6k
  • 8
  • 115
  • 146

1. What is the purpose of PATH?

PATH is an environment variable that contains a colon-separated list of directories where your shell will look for executables that you name on the command line without providing an explicit path to them (as in your jsdoc example). Thus, if your PATH has

/usr/bin:/bin:/home/bin 

then any executable you call by name will be searched for in these directories (in that order) and the first executable found is the one executed.

2. What is the difference between /etc/paths and ~/.bash_profile

According to this question on ServerFault, /etc/paths is used to set PATH globally (i.e. system-wide, for all users) while ~/.bash_profile is used to set per-user preferences (where ~ will be the user's home directory). What is written in .bash_profile can either add to the global PATH from /etc/paths or override it completely.

For the record, /etc/paths seems to be a MAC OS peculiarity: I haven't come across it on GNU/Linux, at least.