1,105,232 Community Members

how to set path permanently in linux

Member Avatar
Newbie Poster
22 posts since Nov 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]


I want to set path permanently in centos. I am able to set path, But when i logout and login the path is going.

Please tell me how to set path permanently

Member Avatar
Veteran Poster
1,182 posts since Sep 2009
Reputation Points: 131 [?]
Q&As Helped to Solve: 193 [?]
Skill Endorsements: 13 [?]


Depending on the shell you are running (probably bash) you set the path in your .bash_profile file. The file is in your home directory and you can add to the entries there:

# User specific environment and startup programs


export PATH
Member Avatar
Senior Poster
3,989 posts since Mar 2010
Reputation Points: 513 [?]
Q&As Helped to Solve: 500 [?]
Skill Endorsements: 87 [?]

Or just:

export PATH=$HOME/bin:/usr/local/bin:${PATH}

This gives precidence to executable files in your personal bin directory, then to those in /usr/local/bin, and finally to the default PATH environment. Note the {} around PATH. That allows a recursive path definition like this, especially if the existing PATH environment is complexly defined. It is safer than not useing the curly braces.

This article has been dead for over three months: Start a new discussion instead
Start New Discussion
Tags Related to this Article