Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Newbie question here. I updated my PATH with export PATH=$PATH:new_directory and I was able to access programs in the new directory but my PATH was reset the next time I logged in. Do I need to save my settings when I make a change like this? If so how?
When you use the command line to do this, it sets the variable for your current shell. If you switch to another terminal and echo $PATH, you'll see it hasn't been changed there.
You need to add the changes to the right config file for your shell. For example, if you use bash, look in your home dir for .bash_profile or .bashrc - one of those files will have some commands that are always executed in a new shell. Add your updated PATH line to that file, then log out and back in again to test.
Another possibility is .profile... also, make sure you are listing all files (i.e ls -A), since they are hidden by default.
What you add to the file depends on what you find already in it... normally people set the variables needed via straight assignment and export them at the end (scripts run in a subshell, export sends one or more vars to the parent shell). There's a good chance your PATH is set and exported already, but the maximum you would have to add to the file is this:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.