Home / افزودن مسیر به path و قوانین لود شدن آن در اوبونتو

افزودن مسیر به path و قوانین لود شدن آن در اوبونتو


The following command adds a path to your current path:

 
export PATH=$PATH:/my/custom/path
 

If you want your setup to execute this command every time, there are a number of places where you can put it. When you login, the following scripts will be executed in this order:

 
/etc/profile      (which starts by loading everything in /etc/profile.d) ~/.profile        (which starts by loading ~/.bashrc if you are running bash)
 

Notes

 
  • ~/.profile is only loaded if ~/.bash_profile or ~/.bash_login DO NOT EXIST. Otherwise, at least bash, will load them instead. It is suggest to use .profile and not the bash specific scripts. So, if in these attempts you created .bash_login, please delete it now.

  • ~/.bashrc is only loaded if you are running an interactive session. (something with a prompt where you can actually type something.

  • ~/.bashrc is loaded again and again, everytime you open up a new terminal. So a new tab in gnome-terminal, a new virtual terminal, etc. So even if you don't login again, .bashrc is loaded (and thereby resets its environment) everytime you open a new shell.

  • Something like byobu should really go into .profile, (otherwise it won't work ;-)

  • Something like paths should go into .profile if you want it to work outside of the interactive sessions. (say when you press alt+f2 in gnome)




     RSS of this page