Search files on Linux: sLocate

There is powerful utility to search or find files on your linux box. It is slocate or locate. You can have Debian, Ubuntu, CentOS, Fedora, RedHat or Suse. It works.

Installing locate

On CentOS or Redhat machine, as mentioned here: install locate, you can install locate as follows:

yum install slocate

sLocate: how it works

Once installed, you would need to update slocate database and this is done by using linux command:


updatedb is automatically installed when slocate is installed. updatedb is to be run before search anything to make sure all search indexes of the files on the linux server are updated.

Once updatedb is run, all files on the server are now updated. You can now search for a file (say, php.ini) like:

locate php.ini


slocate php.ini

This would list all directories (absolute paths) on your sever where php.ini is found and where you have access too.