# Locate Command Linux Problems

**URL:** <https://www.ruby-forum.com/t/locate-command-linux-problems/206898>\
**Category:** NGINX\
**Created:** [May 12, 2011, 8:25pm UTC](https://www.ruby-forum.com/t/locate-command-linux-problems/206898 "2011-05-12T20:25:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [May 12, 2011, 8:25pm UTC](https://www.ruby-forum.com/t/locate-command-linux-problems/206898/1 "2011-05-12T20:25:39Z")

</div>

Hey so I am trying to write installation software. I am installing third  
party software on a computer, but first I check to see if it has already  
been installed. I am trying to use the locate command but it is not  
returning anything. To test it, I put a file that I installed and copied  
it into a different directory. I know it is there, and I copy and pasted  
the title so that I knew that would be correct. “$locate filename.a”  
returns nothing, however. I can be sitting in the correct directory  
staring straight at the file and it will still not give me its location.  
Does anyone know more about how locate works who can help me figure this  
out?

Thanks!

Posted at Nginx Forum:

> **[Locate Command Linux Problems](https://forum.nginx.org/read.php?2,197663,197663#msg-197663)**
>
> Hey so I am trying to write installation software. I am installing third party software on a computer, but first I check to see if it has already been installed. I am trying to use the locate command but it is not returning anything. To test it, I...

---

<div class="post-metadata">

**Author:** ![rubix81](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/7c8e57/32.png) [@rubix81](https://www.ruby-forum.com/u/rubix81)\
**Post date:** [May 12, 2011, 8:31pm UTC](https://www.ruby-forum.com/t/locate-command-linux-problems/206898/2 "2011-05-12T20:31:13Z")

</div>

On Thu, May 12, 2011 at 11:25 AM, rubix81 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Thanks!

Hi -

mlocate, slocate rely on the command ‘updatedb’ which builds a  
database of files that exist.

I don’t think this is the proper way of checking, though… doesn’t  
the distribution support some sort of package accounting, such as RPM  
or deb or something like that?

Other commands which you might find useful are ‘which’, which will  
travers the path and tell you if an executable exists. ‘whereis’  
which does something similar, or you could simply:

find / -name nginx -perm -o+rx

All of these solutions are pretty dirty. If I were you I would try to  
ensure that first you’re using a sane distribution, and second you  
trust whoever maintains that installation to not ever, ever install  
from a tarball, but to always use the distribution’s package  
managemnet system.

Thanks  
-dant
