Locate command

Hello to all,

Can I use the "locate" command on AIX 5.3 like on Linux.
If yes what packages should I install and where can I find them.

Thanks,
Enid

Hm, no, AFAIK locate is neither available from the OS nor from the IBM Linux Toolbox.
What do you want to achieve?

  • Find which installp fileset contains a certain binary? Use which_fileset command instead. To make this work you need bos.rte.install and bos.content_list.
  • Find which man pages exist for a certain binary? Use man -k instead.

Hi shockneck
Thank you for your answer,

I just want to search files (any type) quickly. I know that the same can be achieved with find and different arguments, but I prefer to use locate on Linux because is quicker.
If this isn't achieved on AIX I should stick on find.

Thanks,
Enid

Hi,

it was part of the findutils rpm in linux toolbox for applications (at least in AIX 5.3) ... not sure if it still is in there - you could just try?

Regards
zxmaus

Hi Enux,

You can have a try using:

# whereis filename

fast and easy!

Hi allanwang77,

man whereis says: "The whereis command locates the source, binary, and manuals sections for specified files"

but I want also to search different kind of text/conf files not only executables.

---------- Post updated at 03:11 PM ---------- Previous update was at 03:09 PM ----------

Hi zxmaus,
I think I'll give it a try, findutils says that it includes:

  • find - search for files in a directory hierarchy
  • locate - list files in databases that match a pattern
  • updatedb - update a file name database
  • xargs - build and execute command lines from standard input

what about the find/xargs executables that are running on the system, are they replaced when installing findutils?

BR

-bash-3.00$ whereis resolv.conf
resolv: /etc/resolv.conf /usr/include/resolv.h

---------- Post updated at 09:28 AM ---------- Previous update was at 09:26 AM ----------

-bash-3.00$ whereis dhcpcd.ini
dhcpcd: /etc/dhcpcd.ini /usr/sbin/dhcpcd

---------- Post updated at 09:29 AM ---------- Previous update was at 09:28 AM ----------

If you have the filename, I think it will be working.

---------- Post updated at 09:33 AM ---------- Previous update was at 09:29 AM ----------

If you find it is not working, please give some example, I want to know. To me, it is a good learning chance.

Thanks

I understand what you are trying to say, but lets take an example.
Let's say that on some partition I have diferent directories and inside the directories different files named e.g: file.test.xx where xx is a number.

Now if the files are sparsed on these directories and you give example the command:
whereis file.test34 => you get =>
file: /usr/bin/file

I don't know if you get the point.
These files can be searched with the find command but I want to be quicker in finding it, and not to comsume resources (find consumes lot of cpu)

Regards,
Enid

Got it. If you add path in you profile, it will be working.

Hm, if it was part of the findutils package it is in the toolbox. But in this case I would recommend the findutils package by Michael Perzl. With AIX 7 out the original IBM Linux Toolbox seems more and more ridiculous.