change PATH permanently on Ubuntu

LinuxUnixUbuntuPath

Linux Problem Overview


I'd like to add to PATH the value ":/home/me/play/"
for the installation of Play! framework.
so I ran this command:

PATH=$PATH:/home/me/play

it worked. but in the next time I checked, the value changed back to the old one.

so I guess I didn't "saved" the new value, right?

how do you do that?

Linux Solutions


Solution 1 - Linux

Add

export PATH=$PATH:/home/me/play

to your ~/.profile and execute

source ~/.profile 

in order to immediately reflect changes to your current terminal instance.

Solution 2 - Linux

Add the following line in your .profile file in your home directory (using vi ~/.profile):

PATH=$PATH:/home/me/play
export PATH

Then, for the change to take effect, simply type in your terminal:

$ . ~/.profile

Solution 3 - Linux

Try to add export PATH=$PATH:/home/me/play in ~/.bashrc file.

Solution 4 - Linux

Assuming you want to add this path for all users on the system, add the following line to your /etc/profile.d/play.sh (and possibly play.csh, etc):

PATH=$PATH:/home/me/play
export PATH

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionsocksocketView Question on Stackoverflow
Solution 1 - LinuxlolloView Answer on Stackoverflow
Solution 2 - LinuxndevergeView Answer on Stackoverflow
Solution 3 - LinuxDanil SperanskyView Answer on Stackoverflow
Solution 4 - LinuxBrian CainView Answer on Stackoverflow