Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I often use "locate" command on CentOs to find files.

What's the alternative for this command on Debian ?

share|improve this question
Hi and welcome to the site! For future reference, please take a second and search, before posting here. Copy/pasting your exact title into any search engine would have shown you the answer immediately. – terdon Jun 15 '14 at 17:43
Wow. Really. Wow. – lornix Jun 16 '14 at 8:53
up vote 20 down vote accepted

I recommend locate.

sudo apt-get install locate
share|improve this answer
You may have to sudo updatedb to build an index. – wchargin Jun 15 '14 at 18:19

You can have locate on Debian as well—you may just need to install it. There are (at least) two implementations available, in the locate and mlocate packages.

Installing either one will give you a locate command.

The mlocate version has some additional features (hiding names based on permissions, faster indexing).

share|improve this answer

As the word itself suggest to locate files maybe you can install locate commands, from the original GNU findutils (code here), or from the new implementation Debian squeeze from here (on the right side the link to the sources).

To locate only the binary, source, and manual page files for a command you can always use whereis, remembering that whereis has a hard-coded path, so may not always find what you're looking for.

The whereis command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/.

which instead locate a command and returns the pathnames of the files (or links) which would be executed in the current environment, by searching the PATH for executable files matching the names of the arguments.
If used with -a option it will print all matching pathnames of each argument.

Less efficient in terms of time, more slow because there isn't a database, it can result more efficient in terms of solution proposed. Locate needs that the database is updated, (run updatedb frequently), if not you will have a partial or wrong result. Moreover it's possible that some extensions or directories are excluded from the database (see /etc/updatedb.conf file).

Desktop solutions
If you are searching only for a databased one you can see some project for desktop as Nepomuk, Strigi, Soprano KDE, Virtuoso and Akonadi, but even Deskbar-applet, Beegle for Gnome. They are somehow similar to the discontinued Google Desktop. Some of the database systems can be used from command line too.


share|improve this answer

Use find

find /path/to/dir -type f -name filename
share|improve this answer
thanx, unfortunately find doesn't use prebuilt database of files. Is there something like "locate" there that uses index ? – chubbyk Jun 15 '14 at 16:47
You can use locate by installing it on your debian distro as others suggested :) – polym Jun 15 '14 at 16:50
If you are searching only for the ones with a database please edit your question to have more proper answers. Find is a valid alternative to locate in the terms of your actual answer. It can offer you results that locate cannot. – Hastur Jun 15 '14 at 19:31
also sometimes the database is old and locate can't find your file. So don't rely on locate. – polym Jun 15 '14 at 20:32
"So don't rely on locate." That's mediocre advice unless you have reason to think that file might be recent or already know where to look. A full-filesystem find (which is the proper equivalent to locate) is an inefficient process that will slam the disk cache and may take a considerable time to complete. – dmckee Jun 15 '14 at 20:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.