Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I edit my .profile file to set a permanent value for my PATH variable?

Is there any other file that needs editing? (This is on CentOs 6.2)

share|improve this question

migrated from stackoverflow.com Jan 24 '13 at 1:52

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

    
Why did you close my question???? What's wrong with asking stuff that one doesn't knwo? –  user1508893 Jan 23 '13 at 22:18
    
Stack Overflow is for questions about programming. You may have better luck with this question at unix.stackexchange.com. –  KatieK Jan 24 '13 at 1:31

1 Answer 1

You'll probably want to do this in your shell's rcfile (.bashrc, .zshrc, etc.). You'll want to add something like the following:

export PATH=$PATH:/new/folder/path

if you are only looking to append a file path. Or you can get tricky with it and create a path file (for zsh I have a .zpath file). In there you can do something like:

PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
export PATH

Now every time that file is sourced (source ~/.zpath for example) it will load those paths into your environment. You can add source ~/.zpath to your rcfile so this will happen every time you log in or create a new shell.

share|improve this answer
    
I don't want to append new values to PATH. I want to remove some values, and replace some others with new stuff. Should I just put export PATH= <new path> in my .bashrc file? (I put this in my .profile file, but it didn't seem to ahve any effect) –  One Two Three Jan 24 '13 at 20:18
    
Yea, put that in your .bashrc. –  mgoffin Jan 24 '13 at 20:39
    
Thanks! (I don't know how to mark your answer as the answer, though). (THere is supposed to be a check symbol, isn't there?) –  One Two Three Jan 24 '13 at 20:41
    
Not entirely sure (I haven't asked any questions yet). I thought there was a check image under the upvote/downvote. –  mgoffin Jan 24 '13 at 21:11

Your Answer

 
discard

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