Possible Duplicate:
How do I set a user environment variable? (permanently, not session)

To change the amount of PATH variable , I use : export PATH=...

But when I close the terminal, the amount of PATH becomes what it was at first.

I want to save the changes, so that the amount will be what I want after closing the terminal or logging out.

How can I do this work?

I use Fedora 17, kernel : 3.4.3

  • another possible duplicate about setting environment variables – jw013 Jul 2 '12 at 17:47
  • @Pierre.Vriens thank you for your edits/improvements! Something that I learned when starting to edit: realize that if you edit the text of a closed post (such as this one), it puts it into the ReOpen queue, so please continue to write good comments about what you changed, so that the reviewers know it was just typo-fixes and not an attempt to re-open the question. Thank you! – Jeff Schaller Jul 13 '17 at 14:23
  • @JeffSchaller merci for the comment, will try to do as you suggested. However I might as well skip the closed ones (there are still tons of similar ones to be edited / improved). Not "my" personal preference, but at least it prevents the side-effect you mentioned. – Pierre.Vriens Jul 13 '17 at 14:26
  • de rien! I don't mean to slow your efforts to improve the site. If it was me, I might focus on highly-viewed and/or highly-voted entries (even if they were closed), to provide a better face for them. Again, it makes the reviewers job easy if you clearly indicate what you were doing -- then it's just a "keep closed" vote. – Jeff Schaller Jul 13 '17 at 14:34

make the setting persistent:

add this line: export PATH=/path/to/dir in your ~/.bashrc if using bash, or ~/.zshrc for zsh:

$ vim ~/.bashrc

export PATH=$PATH:/path/to/dir



$ echo "export PATH=$PATH:/path/to/dir" >> ~/.bashrc


  • It's always a good idea to append values to an existing PATH variable. – dkaragasidis Jul 2 '12 at 17:50
  • you are right. i assumed that he knew how to set the path and the problem was only how to make it persistent. – fromnaboo Jul 2 '12 at 17:52

Each time you execute a bash (non-login) shell instance, it reads and executes the .bashrc file in your home directory. Login shells, on the other hand, do that for .profile file, located in your home directory. You can find the difference between login and non-login shells by reading the bash manual.

In your case, open your ~/.bashrc and set there the variable that you want. For example:


Save it, and reload it:

$ source ~/.bashrc

Not the answer you're looking for? Browse other questions tagged or ask your own question.