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

Posted on 2000-01-27
Medium Priority
Last Modified: 2013-12-05
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.
Question by:chench
LVL 10

Expert Comment

ID: 2395735
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?
LVL 15

Accepted Solution

samri earned 400 total points
ID: 2396495

    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,


Expert Comment

ID: 2396526
If you want locate, then get and install the GNU findutils package. Besides locate this will also give you a faster find program.
7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.


Author Comment

ID: 2397478
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.
LVL 15

Expert Comment

ID: 2398331
  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,


Expert Comment

ID: 2419783
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.

Featured Post

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Can you run Linux on a Windows system?  Yep.  Here's how.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question