Welcome! Log In Create A New Profile

Advanced

Re: Locate Command Linux Problems

Dan Trainor
May 12, 2011 02:32PM
On Thu, May 12, 2011 at 11:25 AM, rubix81 <nginx-forum@nginx.us> wrote:
> 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!

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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Locate Command Linux Problems

rubix81 May 12, 2011 02:25PM

Re: Locate Command Linux Problems

Dan Trainor May 12, 2011 02:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 306
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready