LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 12-15-2005, 09:46 AM   #1
unihiekka
Member
 
Registered: Aug 2005
Distribution: SuSE Linux / Scientific Linux / [K|X]ubuntu
Posts: 273

Rep: Reputation: 32
Post 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...

Thanks
 
Old 12-15-2005, 10:11 AM   #2
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
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.
 
Old 12-15-2005, 10:12 AM   #3
dmartins
Member
 
Registered: Oct 2005
Location: Ontario, Canada
Distribution: Arch, Gentoo
Posts: 98

Rep: Reputation: 15
i'm too slow

Last edited by dmartins; 12-15-2005 at 10:17 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set PATH variable for command tracert? princegbenga Linux - Software 2 06-14-2007 07:48 AM
Set the path systemwide/Set the path for a user with Slackware jayhel Slackware 1 06-12-2005 12:24 AM
$path variable ? moby Linux - Newbie 3 06-01-2004 03:18 PM
Where to set system PATH variable Cybers19 Linux - Newbie 4 05-05-2004 01:46 PM
How to set PATH How do I set PATH environment variable? Tranquil Linux - Newbie 3 11-02-2003 02:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration