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.
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
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?
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.
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.
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!
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?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.