LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 09-07-2009, 07:17 AM   #1
yogaboy2
LQ Newbie
 
Registered: Aug 2007
Posts: 14

Rep: Reputation: 0
Whereis


Hi,

I'd like to know how to change the whereis database, or how it looks for the best command to use. I've updated the locate database but it's not using that as there was no change.

For example, I have a system built version of perl in /usr/bin, but I built a newer one in /usr/local/bin. Running 'whereis perl' in a terminal returns /usr/bin/perl.

I can't find how to do this via a search, would anyone know the answer? Any help would be much appreciated.

This is for an OSX 10.4 box, and the whereis on here doesn't take args.
 
Old 09-07-2009, 07:27 AM   #2
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Lubuntu
Posts: 19,176
Blog Entries: 4

Rep: Reputation: 430Reputation: 430Reputation: 430Reputation: 430Reputation: 430
AFAIK, whereis searches via your PATH, so you would need to add /usr/local/bin to your PATH. http://www.faqs.org/docs/Linux-mini/Path.html should be useful to you in understanding and changing the PATH on your system for your users.
 
Old 09-07-2009, 08:02 AM   #3
yogaboy2
LQ Newbie
 
Registered: Aug 2007
Posts: 14

Original Poster
Rep: Reputation: 0
sorry, silly of me, I forgot to add my path

Code:
echo $PATH
/opt/local/bin:/opt/local/sbin:/Developer/usr/bin:/Developer/usr/sbin:/Users/yb2/.cabal/bin/:/Library/PostgreSQL/8.4/bin/:usr/local/mysql/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin
/usr/local/bin is before /usr/bin in the path and it's been that way for a while.

Last edited by yogaboy2; 09-07-2009 at 08:03 AM. Reason: added code tags to get rid of the horiz scroll bar
 
Old 09-07-2009, 09:10 AM   #4
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Lubuntu
Posts: 19,176
Blog Entries: 4

Rep: Reputation: 430Reputation: 430Reputation: 430Reputation: 430Reputation: 430
You could try this:
Code:
whereis -BMS /usr/local/bin perl
Under the Bugs section of the whereis man page it says:
Quote:
whereis has a hard-coded path, so may not always find what you're look-
ing for.
This may mean that it won't find the files however you term it!
 
Old 09-07-2009, 10:48 AM   #5
yogaboy2
LQ Newbie
 
Registered: Aug 2007
Posts: 14

Original Poster
Rep: Reputation: 0
The whereis that comes with OSX doesn't have those options or that part of the man page! Looks like I'll just have to live with it.

Thanks for helping me out.
 
Old 09-07-2009, 10:57 AM   #6
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 3,919

Rep: Reputation: 779Reputation: 779Reputation: 779Reputation: 779Reputation: 779Reputation: 779Reputation: 779
Quote:
Originally Posted by yogaboy2 View Post
Hi,

I'd like to know how to change the whereis database, or how it looks for the best command to use. I've updated the locate database but it's not using that as there was no change.

For example, I have a system built version of perl in /usr/bin, but I built a newer one in /usr/local/bin. Running 'whereis perl' in a terminal returns /usr/bin/perl.

I can't find how to do this via a search, would anyone know the answer? Any help would be much appreciated.

This is for an OSX 10.4 box, and the whereis on here doesn't take args.
I may have misunderstood, but I don't think that 'whereis' does what you think it does. The 'whereis' command is a convenience to users to help them locate commands. So, if a command is not executing, a 'whereis' helps you to check that its in your path and have the a[ppropriate rights. That's useful.

When, however, you want to execute 'command_name' the system walks your path itself; it tries '/this/that/command_name' (where this/that/ is the first element in your path) and if that executes, you are in business. If not, it tries /'the/other/command_name' (where the/other/ is the second element in your path)... And, so on.

So, whereis isn't used at this stage. And what gets executed is the first matching element in your path; coming second is coming nowhere. And note that when I say 'you are in business' this is not necessarily the business that you had wanted to be in.

Plese correct me if I'm wrong guys!
 
Old 09-07-2009, 09:01 PM   #7
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
You're more or less right, but part of that (PATH) is the 'which' cmd

http://linux.die.net/man/1/whereis
http://linux.die.net/man/1/which
 
  


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
Whereis K3bSetup mickeyboa Fedora 7 05-28-2006 03:09 PM
'Whereis' output Ander Linux - Newbie 3 05-05-2006 06:18 AM
using $PATH with whereis shanenin Programming 5 09-16-2005 10:28 AM
whereis kate shanenin Linux - Software 4 09-15-2005 03:42 PM
help : whereis mkinitrd? marsques Slackware 6 05-23-2004 04:52 PM


All times are GMT -5. The time now is 06:48 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration