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
Posted at Nginx Forum:
On Thu, May 12, 2011 at 11:25 AM, rubix81 [email protected] wrote:
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