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

What's the alternative for this command on Debian ?


5 Answers 5


I recommend locate.

sudo apt-get install locate
  • 13
    You may have to sudo updatedb to build an index.
    – wchargin
    Commented Jun 15, 2014 at 18:19
  • In my case, locate did provide the command, but the package mlocate gave me some configuration files such as /etc/updatedb.conf that allowed for smoother use.
    – xryophile
    Commented Oct 10, 2020 at 17:01

As the word itself suggests to locate files maybe you can install locate command, from the original GNU findutils (code here), or from the new implementation Debian buster (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 it may not always find what you're looking for (if not included in that hard-coded path).

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

which instead locates 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 solutions proposed. Locate needs that the database is updated, (run updatedb frequently), if not you will have a partial or wrong result. Moreover, it is 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 program indexed with a database, you can see projects for desktop such 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.


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).

  • pagure.io/mlocate is the new official home site of mlocate.
    – Pablo A
    Commented Jul 8, 2017 at 3:59
  • @PabloBianchi (confused) I'm not sure what that has to do with this answer—any Debian user is going to apt install mlocate (or similar) to install it. Could you please elaborate how you're suggesting I improve the answer (or maybe just suggest an edit?). On the off-chance you're reporting the outdated location at tracker.debian.org/pkg/mlocate and in the package, that should be sent to Debian as a bug report. I've just done so, see bugs.debian.org/cgi-bin/bugreport.cgi?bug=867640
    – derobert
    Commented Jul 8, 2017 at 4:15
  • @deribert mlocate developer (Miloslav Trmac) just told me about this recently change. I think is very useful for people to know official sites of projects in order to let them get involve. I would be happy to suggest an edit if you think so.
    – Pablo A
    Commented Jul 8, 2017 at 4:18

Use find

find /path/to/dir -type f -name filename
  • thanx, unfortunately find doesn't use prebuilt database of files. Is there something like "locate" there that uses index ?
    – chubbyk
    Commented Jun 15, 2014 at 16:47
  • 1
    You can use locate by installing it on your debian distro as others suggested :)
    – polym
    Commented Jun 15, 2014 at 16:50
  • 1
    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
    Commented Jun 15, 2014 at 19:31
  • also sometimes the database is old and locate can't find your file. So don't rely on locate.
    – polym
    Commented Jun 15, 2014 at 20:32
  • 2
    "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. Commented Jun 15, 2014 at 20:56

The Silver Searcher

I use it to look inside source code/files and this alias similar to mlocate for filenames:

alias superlocate='bash -xc '\''ag -g $0 --hidden'\''  2>/dev/null'


  • This and more probably could be accomplished with ripgrep.
  • Also, now become popular plocate, which is faster, but lacks of --transliterate option, which I found extremely useful.
  • A faster alternative to find could be fd

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .