Difference between revisions of "Linux Shell Environment Path"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
m
m
Line 13: Line 13:
 
Look at /etc/profile which is used for each new user directory created.  It has a script still looking for .bash_profile so it appears that if a .bash_profile is created, the script will identify its existence and use it.
 
Look at /etc/profile which is used for each new user directory created.  It has a script still looking for .bash_profile so it appears that if a .bash_profile is created, the script will identify its existence and use it.
  
Also note that .bashrc is executed every time a bash shell is opened and .bash_profile only if it's a login shell. Also, it appears that the default profile still looks for
+
Also note that .bashrc is executed every time a bash shell is opened and .bash_profile only if it's a login shell.

Revision as of 13:34, 3 June 2019

The current path environmental variable can be viewed

echo $PATH

capital letters on PATH. Want to know if a command is in $PATH?

which command

Need to add a directory path to the shell path statement for your own scripts?

  • Per user shell
vi ~/.profile

Look for the line with a comment about "set PATH so it includes user's private bin directories" and add your custom path in there like this: ( added /myscripts to the path )

PATH="$HOME/bin:$HOME/.local/bin:/myscripts:$PATH"

note: In the past we used ~/.bash_profile and had to include "export PATH"

Look at /etc/profile which is used for each new user directory created. It has a script still looking for .bash_profile so it appears that if a .bash_profile is created, the script will identify its existence and use it.

Also note that .bashrc is executed every time a bash shell is opened and .bash_profile only if it's a login shell.