LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 11-19-2003, 03:25 PM   #1
mep]-[isto
Member
 
Registered: Nov 2003
Distribution: Slackware 9.1
Posts: 61

Rep: Reputation: 15
Question linux equivalent of the path in windows


hi all, i ve had a look around and cant seem to find what im looking for so ive come here for help. my question is; how do i go about defining where bash looks for binary executable files when you type just the name in on a command line? example: as a user, if i type gaim it launches gaim automatically, even though gaim is in /usr/local/bin. the reaso i ask this is because for some reason im not sure about, when im root and i type commands it wont look in the same places it would as when im in my normal user account.

my ultimate aim is to add /usr/local/sbin/ to roots path

thanks in advance!
 
Old 11-19-2003, 03:33 PM   #2
vincebs
Member
 
Registered: Oct 2003
Location: Mississauga, ON
Distribution: Ubuntu 9.04
Posts: 494

Rep: Reputation: 30
I know how to set the PATH temporarily but everytime I restart bash it resets it to the default.

PATH= ....

How do I set it permanently? And also the Java classpath variable, how do I set that too?
 
Old 11-19-2003, 03:34 PM   #3
linuxbotx
Member
 
Registered: Oct 2003
Location: USA
Distribution: Fedora Core 4
Posts: 247

Rep: Reputation: 30
The path would be in your .bashrc file.
 
Old 11-19-2003, 03:44 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,570

Rep: Reputation: 171Reputation: 171
You can change in in .bashrc or /etc/profiles. The line will be
export PATH=$PATH:/usr/local/sbin
 
Old 11-19-2003, 04:36 PM   #5
vincebs
Member
 
Registered: Oct 2003
Location: Mississauga, ON
Distribution: Ubuntu 9.04
Posts: 494

Rep: Reputation: 30
Quote:
Originally posted by Mara
You can change in in .bashrc or /etc/profiles. The line will be
export PATH=$PATH:/usr/local/sbin
Sorry, I don't get what this line does. Does it export the variable to /usr/local/sbin? Or is it adding /usr/local/sbin to the PATH? If so, where does the system get $PATH from?

So what would I do to add, for example, "/downloads" to my PATH?

Last edited by vincebs; 11-19-2003 at 04:37 PM.
 
Old 11-19-2003, 06:15 PM   #6
mep]-[isto
Member
 
Registered: Nov 2003
Distribution: Slackware 9.1
Posts: 61

Original Poster
Rep: Reputation: 15
as far as i understand that would add /usr/local/sbin to $PATH, though im not sure where $PATH is initially defined, where would that be? it seems by default the path for my account 'mick' includes /usr/bin, /usr/local/bin etc but root is very restritive and only seems to include /sbin type directories

also i dont have /etc/profiles or .bashrc; would it be possible to explain how profiles is structured? i.e a directory or a file and what advantages/disadvantages it has over the .bashrc file. also im presuming .bashrc would be located in my home or root dir (respectively)?

sorry for all the questions, only reason is i really like knowing why more than how :P (though i guess the why would be ponitless without the how!)

Last edited by mep]-[isto; 11-19-2003 at 06:22 PM.
 
Old 11-20-2003, 03:34 PM   #7
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,570

Rep: Reputation: 171Reputation: 171
The command export PATH=$PATH:/usr/local/sbin adds /usr/local/sbin to current PATH. The PATH variable is usually defined in /etc/profiles. The command looks like this
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
There can be more directories. When you don't use $PATH inside it's definition (after =), the old one is deleted and the directories listed (separated by : as you can see) in the command are used.

A common mistake is adding new directory to PATH this way:
export PATH=/usr/local/sbin
The problem is that it deleted the old PATH, so only /usr/local/sbin would be in it, making the system use hard.

To add any other directory, just use something like
export PATH=$PATH:/downloads
or, if you have more dirs to add
export PATH=$PATH:/downloads:/important/executables

/etc/profiles defines PATH for all users. If you change something here, all users will be affected. On the other hand, /home/yourlogin/.bashrc is your own, private file. If you add such a line here, only your PATH will change.
 
Old 11-21-2003, 03:13 PM   #8
mep]-[isto
Member
 
Registered: Nov 2003
Distribution: Slackware 9.1
Posts: 61

Original Poster
Rep: Reputation: 15
thanks mara, and all who replied! good info nice to hear people explaining things aswell. i think the thing i enjoy most about linux is udnerstanding it, not just knowing to do this and that and when asked why i think...hmm, i dont know.

thanks to all! oh and btw this is a damn fine forum, good ppl offering good help!
 
Old 11-21-2003, 03:17 PM   #9
mep]-[isto
Member
 
Registered: Nov 2003
Distribution: Slackware 9.1
Posts: 61

Original Poster
Rep: Reputation: 15
i just had a look in my /etc directory and couldnt find profiles, the cloest thing i found was profile.d (a directory), is this what im looking for? if not...what is this? and if this isnt it, is profiles a file or directory?

thanks!
 
Old 11-21-2003, 03:21 PM   #10
bosewicht
Senior Member
 
Registered: Aug 2003
Location: Honolulu, HI
Distribution: Arch
Posts: 1,380

Rep: Reputation: 47
as far as java and defiining the path here is a really nice tutorial i have found and posted a couple of times....

http://www.dougsparling.com/comp/ho...x_java-1.3.html
 
Old 11-21-2003, 03:22 PM   #11
bosewicht
Senior Member
 
Registered: Aug 2003
Location: Honolulu, HI
Distribution: Arch
Posts: 1,380

Rep: Reputation: 47
i don't think the first link works

http://www.dougsparling.com/comp/how..._java-1.3.html
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Linux equivalent to Windows Explorer sjia Linux - Software 22 10-13-2013 04:32 AM
Windows Notepad Equivalent in Linux? Bob5 Linux - Software 21 09-16-2013 02:43 AM
What equivalent of MSDN (in MS Windows ) is in Linux Igor007 Programming 9 05-15-2009 09:35 AM
What is the equivalent of Windows events in Linux DavidW567 Programming 8 12-24-2004 05:14 PM
Linux equivalent to windows registry? marri Linux - Newbie 10 07-22-2004 12:07 AM


All times are GMT -5. The time now is 01:18 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration