Questions tagged [locate]

`locate` is a command-line tool for local file search using a database.

locate is a command-line tool for local file search using a database. The database is a front compressed list of files, it is generated by locate's companion, updatedb.

It is a faster but less versatile alternative of .

There are numerous locate implementations, with mostly compatible base features:

  • locate - from the GNU findutils
  • mlocate - The 'm' stands for "merging": updatedb reuses the existing database to avoid rereading most of the file system, which makes updatedb faster and does not trash the system caches as much.
  • rlocate - The behavior of rlocate is the same as slocate, but it also maintains a diff database that gets updated whenever a new file is created. This is accomplished with rlocate kernel module and daemon.
  • slocate - Security Enhanced version of the GNU Locate (unmaintained, site down)

Some graphical frontends also exists:

  • Catfish is a frontend for different search engines (daemons).
  • KarambaLocate is a SuperKaramba widget, a sort of GUI for shell command locate.
  • kio-locate - A KDE I/O Slave, enables to search from Konqueror.
  • KwickFind - KDE Kommander script
  • Zeloc - Zenity-Frontend for locate
  • XLocate is an X Qt4 front-end to the standard Linux locate utilities.
143 questions
158
votes
4 answers

locate vs find: usage, pros and cons of each other

In Linux and Unix systems there are two common search commands: locate and find. What are the pros and cons of each? When one have benefits over the other?
m0nhawk
  • 2,628
  • 3
  • 20
  • 28
129
votes
4 answers

How to update Linux "locate" cache

How can I update the cache / index of locate? I installed new packages and the files are clearly not yet indexed. So which command do I have to commit, in order for the indexer to trigger? I'm currently working on debian jessie (testing): with Linux…
sweisgerber.dev
  • 1,421
  • 2
  • 12
  • 9
46
votes
2 answers

Difference between locate and mlocate

I wanted to install the command locate, which is available via sudo apt-get installmlocate. However, I first ran sudo apt-get installlocate which seems to have installed something else. Typing the command locate however seems to call upon…
P A N
  • 1,661
  • 4
  • 18
  • 23
43
votes
1 answer

How do I enable locate and queue the database to be built?

On a new Ubuntu 10.4 instance, I tried to use the locate command only to receive the error locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory from using this command on other systems I'm guessing that this means the…
cwd
  • 44,479
  • 71
  • 146
  • 167
27
votes
3 answers

What kind of database do `updatedb` and `locate` use?

The locate program of findutils scans one or more databases of filenames and displays any matches. This can be used as a very fast find command if the file was present during the last file name database update. There are many kinds of databases…
Tim
  • 98,580
  • 191
  • 570
  • 977
23
votes
2 answers

updatedb: can not open a temporary file for `/var/lib/mlocate/mlocate.db'

I go to use the updatedb command to update the index and I get updatedb: can not open a temporary file for `/var/lib/mlocate/mlocate.db' fyi The locate command is working, e.g. $ locate…
Michael Durrant
  • 41,213
  • 69
  • 165
  • 232
18
votes
8 answers

Exclude directories in locate search

A search with locate finds paths in the filesystem. Often, you know a priori you are interested in either files only, or directories only. A 'locate' search often returns many results. It would be useful to include only one of the types in the…
Volker Siegel
  • 16,983
  • 5
  • 52
  • 79
14
votes
8 answers

How can I use locate only for a directory

This finds a large number of files that are under various subdirectories of "Dropnot" $ locate Dropnot Can I find just the directory location with locate? (which directory "Dropnot" is in) So if Dropnot is in /home/me/, that's the only entry that…
Michael Durrant
  • 41,213
  • 69
  • 165
  • 232
14
votes
5 answers

Alternative for "locate" on debian

I often use "locate" command on CentOs to find files. What's the alternative for this command on Debian ?
chubbyk
  • 275
  • 1
  • 2
  • 5
13
votes
4 answers

regex matching with "locate"

I'm trying to use the locate command to find files in my home folder, however whenever I try and run this I get no results: locate -i -l 4 --regexp '^\/home\/jack\/[A-Za-z0-9\/\ ]*(My.)*$' I've also tried ^\/home\/jack\/^(?!\.)[A-Za-z0-9\/\…
Jack Jones
  • 131
  • 1
  • 1
  • 4
11
votes
3 answers

What is the difference between locate txt vs locate *.txt?

Output of locate txt |…
11
votes
1 answer

How is updatedb so much faster than find?

How is updatedb so much faster than find? Here's a timed comparison between updatedb and a find command that does a seemingly similar task. compare.sh #!/usr/bin/env bash cmd="sudo updatedb" echo $cmd time eval $cmd cmd="sudo find / \ -fstype…
Praxeolitic
  • 1,638
  • 3
  • 18
  • 24
10
votes
2 answers

Why does pipe not work with cat and locate?

I am trying to perform this: locate pg_type.h | cat But this command simply does nothing different than locate pg_type.h What should I change ? I want to perform cat pg_type.h wherever pg_type.h may be.
Stephane Rolland
  • 4,147
  • 6
  • 37
  • 49
10
votes
3 answers

How to `locate` multiple files and open them in vim?

Suppose that I have a file named filename123.txt and it is the single file that is named so, and I can locate it with the command locate filename123. And it returns only this file. Now I want to open it with vi/vim. But I don't want to go to that…
Santosh Kumar
  • 3,753
  • 6
  • 28
  • 36
10
votes
4 answers

How to find a file in the filesystem from the command line?

I'd like to find where a file (with a partially-known filename) is in the file system. I'd like to know how to do this from the command line, rather than using a GUI utility. In Windows, I'd run the following: cd /d C:\ dir *filename* /s What's…
Iszi
  • 495
  • 2
  • 5
  • 14
1
2 3
9 10