Tille - I can see you, read those man pages!   Tille's Site

Can I use the locate command on my Solaris?

Yes you can, it's UNIX. Here's how to activate it:

  • Download the findutils package from sunfreeware or a mirror, for instance ftp.skynet.be. Make sure that you have the most recent package, the one with the highest possible serial number.

  • Unpack the package using gunzip

  • As root, go into the directory where you unpacked the package, and add it to your system using the command

    pkgadd -d findutils-<version>
  • Verify the installation of the package, listing the content of the /usr/local/bin directory, which should show you the existence of the locate and updatedb commands on your system now.

    Note that /usr/local should be a symbolic link to e.g. /opt/local for compliance with the current standards for UNIX filesystems. Since a lot of packages from sunfreeware install in /usr/local by default, creating a link is a way to achieve this compliance without having to recompile the package yourself.

  • As root, run the updatedb command.

  • Test the locate command as a non-privileged user. Initially, you might have to use the full path to the command to accomplish this.

  • If all goes well, you should make sure that a regular re-indexing takes place - locate complains anyway if the file index on which its results are based gets too old.

  • For smooth operations, edit your system or root crontab file, issuing the command crontab -e as root.

  • Add a line like the following:

    24 5 * * * /opt/local/bin/updatedb
  • Add the installation directory of the findutils to your PATH variable if it is not yet there. For system-wide configuration, make the PATH setting in the /etc/profile file:

    export PATH=$PATH:/opt/local/bin
© 1995-2010 Machtelt Garrels - tille - Powered by vIm - Best viewed with your eyes - Validated by W3C - Last update 20100511