What is the Unix (Solaris) equivalent of Linux "locate" command?

Due to my job specification, I need to use Solaris from time to time beside my favorite Linux options. I was quite frustrated when trying to find the Unix equivalent of the Linux command "locate" to find some files/programs. I tried to use "find". But with the options I could understand, it really did not work as efficiently as "locate". Can someone give me some advice on this?

Thanks a lot.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Can you pls explain what you want to find.
To find a file use containing the string aba for example use

find / -name "*aba*" -print

But find has many options. So what do you need?

    I do agree with rbr on specific scenario where you need to "find" the files.  Look at the manual page for find, or a quick one will be
   find / -name filename.ext -print  
   This will search the full filename from root (/) and display it to standard output.  This however requires you to have sufficient rights to traverse the filesystem (for example user root), otherwise you will be geting "permission denied" on filesystem or directory where you don't have read access to.
  find . -name filename.ext -print will do the same thing except the starting point is the location (directory) you are in, and recursively traverse within current directory.
  If you quote the filename (or filespec we call it), then you can use wildcard.  For example: find / -name "???report.txt" -print will cause the lookup to be limited to filename that begins with three (3) character followed by report.txt.  As I highligted, try man find, and you will find other options as well, such as criteria link creation date, accessed date, owner UID, etc.

  Another option is "which" command.  This will display the location of program within you search path.  If your environmetn variable
  PATH=/bin:/usr/bin:/usr/local/bin , and you have program1.sh in every of these directory, issuing

       $ which program1.sh
will result in
This is important to make sure that you know which binary you are running.  Perhaps, you could check for which ps.  You know that in Solaris (at least in Solaris 7) it does, ps is in two directory.  /usr/bin and /usr/ucb/bin.  By doing which ps, will tell you which one of the ps is actually the one we will be executing.

Hope this helps,


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If you want locate, then get and install the GNU findutils package. Besides locate this will also give you a faster find program.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

chenchAuthor Commented:
All answers to my question are very good. I got the impression that "locate" in Linux returns  results much faster than "find" in Solaris. Is this because Solaris has much larger file system than Redhat and other Linux versions? Or because Linux OS has better file (and directory) structure which is easier to search?

By the way, Reinier,  Can you direct me to the site where I can download the findutils package? Thanks a lot.
  The impression that GNU find are faster than Solaris find, maybe true, but I believe it is really subjective.  Speed are relative to so many factors.  Hardware, OS environment, and even our personal mood at that time. :)  Anyhow, most people will agree the GNU software are better than the rest (and still .. relative).

  If you are looking for precompiled binaries (for almost all GNU software for Solaris), try http://www.sunfreeware.com
  If you can not find it there, try http://metalab.unc.edu (formerly know as Sunsite at UNC).  You should be able to grab a copy of the source code, and compile it.  (to compile, grab a copy of GNU gcc)

good luck,

locate works by creating a file at night containing your complete mounted filetree. This is a lengthy process. The locate command itself only searches that file, which is much faster, but the file is of course not always up to date.

GNU find is faster than Solaris find because they optimized it, e.g. it doesn't stat every file or directory that it comes across, only the directories and subdirectories.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.