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.
The fix depends on what shell you are running. You have to add your path change into the shell startup file. For bash, it would be .bashrc in your home directory. For ksh it would be the .kshrc file.
If you don't have one in your home directory, you are probably using a system default one. For bash, that would be, /etc/bashrc file. You probably shouldn't modify that one, but copying it into your directory as a .bashrc may work, and you can modify that one.
The fix depends on what shell you are running. You have to add your path change into the shell startup file. For bash, it would be .bashrc in your home directory. For ksh it would be the .kshrc file.
If you don't have one in your home directory, you are probably using a system default one. For bash, that would be, /etc/bashrc file. You probably shouldn't modify that one, but copying it into your directory as a .bashrc may work, and you can modify that one.
Thanks for your reply. I know that I must include it to my bash configuration files. But I read on a book that when I execute the "export variable" command, before I reboot the system, I can use the variable in any other shells that I open afterward. But the command does not work...
If I am misunderstanding what you said, just ignore this.
I could be wrong, but I don't think any changes you make to PATH would carry over past a reboot unless you add something to either the profile or rc file for that shell. And, I think that goes for any variables you define in a shell, whether you export or not. Now, if you change the value of a variable, then spawn an new shell from the one you modified it in, that variable is available.
Thanks for your reply. I know that I must include it to my bash configuration files. But I read on a book that when I execute the "export variable" command, before I reboot the system, I can use the variable in any other shells that I open afterward. But the command does not work...
That's not quite correct. When you export a variable it will be inherited from child processes, that is from every subshell which is child of the current shell. But if you open another session (terminal) you start another parent shell which does not know anything about the changes made in the first.
In summary, every open terminal on your desktop has its own environment as set up by the initialization files (/etc/bashrc, /etc/profile, ~/.bash_profile, ~/.bashrc and so on). Any local change is ignored from the other shells.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.