Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I kept trying adding a path to my variable path using the export.. But when I close the Terminal and open a new one I find that the PATH is not added.

How can I add it to be generic for all sessions ?

Thanks a lot!

share|improve this question

migrated from Jul 24 '13 at 14:04

This question came from our site for professional and enthusiast programmers.

Please show how you define it. Should be something like PATH=$PATH:/new/dir in your ~/.profile. – fedorqui Jul 24 '13 at 8:49
@fedorqui unless you're using OSX, it should be in ~/.bashrc not ~/.profile. ~/.profile is only read by login shells. – terdon Jul 24 '13 at 15:20
@terdon so ~/.bashrc is loaded always? although the login is visual, not shell one? – fedorqui Jul 24 '13 at 15:21
@fedorqui it will be loaded every time you open a terminal. ~/.profile is ignored unless you run a login shell. – terdon Jul 24 '13 at 15:26
up vote 2 down vote accepted

If you close the terminal, whatever changes you made to the environment are lost the next time you open it. All export does is, it retains the environment changes you made in the current shell so that if you spawn a new subshell (by running bash or otherwise).

If you want these changes to persist across sessions, you can add that export command to a login file, like .login or .bashrc

share|improve this answer
Can you clarify more how can I change that in .login or .bashrc ?!! – Michael Girgis Jul 24 '13 at 8:57
Well, you just need to edit your ~/.bashrc or ~/.login to add the line where you exported your command. Read more – S.R.I Jul 24 '13 at 9:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.