Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
Distribution: SuSE Linux / Scientific Linux / [K|X]ubuntu
Posts: 273
Rep:
how to set $PATH variable definitely
Does anybody know how to set the PATH variable, such that it remains there even if I close the console and open it again? Because now I do the following in SuSE (Bash):
PATH=$PATH:/{my_path*}
export PATH
during the console session the PATH is set correctly, but when I close it and then open (or after re-login or reboot), it's gone. I have to type it everytime I want to use something from the folder my_path..., which is daft. Any help or suggestions?
I have look in /etc/profile, but there it says I should not alter that file, but use profile.local, which does not exist...
There are a few ways how you can accomplish this, depending on what you want exactly:
-if you want this PATH for your user only, put the commands:
PATH=/your/path:$PATH
export PATH
in your $HOME/.bashrc (is read each time you start an interactive bash shell)
or your $HOME/.profile (general)
-if you want to apply it to all users (you need to be root user to have access), then
put the commands in the /etc/bashrc (for Bash sessions) or /etc/profile (general).
That is, assuming you're using the Bash shell (Linux). For other shells,
the commands can be slightly different, and the files ".bashrc" and "/etc/bashrc" have
different names.
For more info, try looking at
man <your shell> (ie "man bash" "man ksh" "man csh", etc).
Note also that some programs and daemons use their own environment ($PATH is commonly referred
to as an environment variable). For instance, cron.
See the daemons' man page for details.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.