Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change PATH permanently on Ubuntu [closed]

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?

like image 817
socksocket Avatar asked Jul 29 '12 12:07

socksocket


People also ask

How permanently change PATH in Linux?

To make the change permanent, enter the command PATH=$PATH:/opt/bin into your home directory's .

How do I permanently add PATH to PATH?

Permanently add a directory to $PATHbashrc file of the user you want to change. Use nano or your favorite text editor to open the file, stored in the home directory. At the end of this file, put your new directory that you wish to permanently add to $PATH. Save your changes and exit the file.

How do I permanently set a PATH in Linux for all users?

Permanently Set $PATH for All Users To permanently set system PATH for all users on the system, append the following lines at the end of the /etc/profile file. On some Linux distros, you can also use the /etc/bash. bashrc file (if it exists)but it should be sourced in /etc/profile for changes in it to work.


2 Answers

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.

like image 93
lollo Avatar answered Oct 04 '22 15:10

lollo


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 
like image 35
ndeverge Avatar answered Oct 04 '22 13:10

ndeverge