Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 the 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
(sorry for my weak english)

share|improve this question

marked as duplicate by manatwork, jw013, Shawn J. Goff, uther, mattdm Jul 2 '12 at 17:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
another possible duplicate about setting environment variables –  jw013 Jul 2 '12 at 17:47

2 Answers 2

up vote 3 down vote accepted

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

:wq

or:

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

LATER EDIT!

share|improve this answer
    
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
    
thanks for the tip. –  fromnaboo Jul 2 '12 at 17:54

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:

PATH="/some/new/path:$PATH"

Save it, and reload it:

$ source ~/.bashrc

share|improve this answer

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