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

learn more… | top users | synonyms

3
votes
3answers
158 views

How find only executable files using 'locate'?

locate gtags would find all the files named gtags. What if I only need executables, is there any way to do this?
1
vote
2answers
30 views

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 ...
1
vote
2answers
36 views

Cannot delete file, but can delete parent directory

So basically, I'm trying to delete the files: /var/lib/mysql/db/nomNomina2.* and when I look for them with locate, I get the following output: /var/lib/mysql/db/nomNomina2.MYD ...
3
votes
1answer
5k views

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 Index.xml ...
0
votes
4answers
98 views

Search for and remove files safely

I would like to search for all the nohup.out in my mounted filesystems, and delete them. There are some directories and files whose filenames contain space, so I think of xargs -0. To be safe, I ...
7
votes
6answers
1k views

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 ...
2
votes
2answers
1k views

How to add specific directories to “updatedb” (locate) search path?

I keep my digital music and digital photos in directories in a Windows partition, mounted at /media/win_c on my dual-boot box. I'd like to include those directories—but only those directories—in the ...
59
votes
4answers
19k views

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?
1
vote
1answer
24 views

Regex quantifiers are not working well with locate

This output is rather self-explanatory: XXXXX@debianvirtualbox:~$ locate -r "^/var/lib/tomcat[0-9]/.*" -l 10 /var/lib/tomcat8/conf /var/lib/tomcat8/lib /var/lib/tomcat8/logs /var/lib/tomcat8/webapps ...
2
votes
2answers
82 views

Faster search than find

Is there a way to find things faster than find . I am/was doing :- $sudo find / -perm +4000 But it takes ages to find the required info. and I know that most of the files which would that specific ...
0
votes
1answer
32 views

Shorthand alternative to find

Is there any alternative out there for find similar to ag and ack? I'm really tired of having to type: find some/app -iname "some_file*" I much rather just type: find "some_file*" And have it ...
1
vote
0answers
37 views

What are the major differences between the Darwin/BSD and GNU versions of Findutils?

OS X comes with its own versions of find, locate, and xargs. GNU versions of these utilities are also available as part of GNU Findutils. What are the major differences between the two versions? Is ...
1
vote
0answers
495 views

What exactly files whose names' prefix is “AT.postflight.” are needed for?

I am not sure if this question should be asked here, since I am on an OS X, but since I am using bash, and I am asking about the meaning and the purposes of some files. I am trying to understand why ...
23
votes
2answers
16k views

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 ommit, in order for the indexer to trigger. I'm ...
1
vote
1answer
39 views

Locate --regex with negative lookahead

Problem I tried to implement a negative lookahead when searching a file with locate like this: locate --regex "apple(?!t)" However I'm getting the following error, because there seems to be some ...
1
vote
2answers
354 views

how to store output of a command into array with each value in a double quote

I want to store each output in double quoted array values. values can have space also. FOUNDFILES=($(locate --database ~/.locate.db -i -b "$INPUT")) if input to the locate command is very very ...
9
votes
1answer
394 views

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 ...
0
votes
1answer
51 views

updatedb.conf, Ignore files using pattern match/globbing

Running locate command with a file name returns multiple entries as, a.py a.pyc a.py~ Obviously, i am not looking for binaries/compiled files. I tried to configure locate command to ignore files ...
4
votes
1answer
334 views

No output from locate command

I usually find the answers to all my Unix related problems already posted as questions and answers. However, this particular issue has had me stumped for the past hour so I thought I’d ask my first ...
0
votes
1answer
35 views

Can't find the location of DUMPed file system

I dumped a file system, chose the name for the dump ("home_fs_dump"), the dump was declared successfull, and yet I couldn't locate this name anywhere in the system. (And at the end I tested if locate ...
0
votes
0answers
31 views

mlocate not returning any results for known file, even after updatedb

I am speechless... [root@Centos-PHP56 webroot]# ls -al php_errors.log -rw-r--r-- 1 apache apache 327 Apr 21 01:49 php_errors.log [root@Centos-PHP56 webroot]# updatedb [root@Centos-PHP56 webroot]# ...
2
votes
1answer
77 views

Locate specific folders

I want to locate all folders on my server that end with 'wordpress-seo'. I tried find command but it takes too long. sudo find /home/w/s -type d -name 'wordpress-seo' Now I am trying Locate ...
1
vote
1answer
67 views

locate a file by its full file name?

When I run locate syn, it will return files with syn appearing in their file names. How can I search for files with full name syn? Is locate --regex syn$ the correct way, while locate --regex ^syn$ ...
0
votes
1answer
43 views

Open a result of `locate` with `vi`

I'd like to get the nth (3rd) result of locate, and then open it to vi. $ locate /private/etc/my.cnf /private/etc/my.cnf.bak_ /usr/local/mysql-5.6.22-osx10.8-x86_64/my.cnf ....
0
votes
0answers
51 views

Is there a `find` command that uses a database, like `locate`?

locate is simple yet quick because it's database based. find offers much more options but it's slower because it actually browses the filesystem each time it's invoked. So.. find using a database ...
9
votes
3answers
659 views

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 ...
1
vote
2answers
54 views

Including Directories in Locate on Mac OS X

Can anybody shed light on which directories OS X decides to put in the locate database and which it decides to omit? It's pretty clear that ~/Library is out - which others? And how do I modify this ...
2
votes
1answer
78 views

Getting globbing to work with `locate`?

I'm on Ubuntu 11.04, where I have: $ locate --version mlocate 0.23.1 [...] The man locate page says: If --regex is not specified, PATTERNs can contain globbing characters. If any PATTERN ...
5
votes
1answer
152 views

Is there a way to have Nautilus include mlocate in the results?

When searching for files, I often prefer using locate (because of the speed). However, I end up opening a terminal just for that purpose and then closing it again. Not a big problem for me, but my ...
0
votes
1answer
74 views

How do I tell which php.ini I am using after doing a 'locate php.ini'?

I'm currently running CentOS and also have cpanel installed. I have root access to the server. When I do a 'locate php.ini', I get a page full of results. Is there a way to find out which php.ini ...
1
vote
1answer
50 views

How do you inverse a “locate” command. Ex. Show everything except X

when doing a locate to find a specific file, it shows alot of stuff, but is there a way to inverse what is shown? Ex. locate anything that has the word drupal in it, but don't show anything from the ...
2
votes
1answer
42 views

How do I search files without certain extensions in their names?

I would like to search recursively in all the files and directories under a directory for some strings e.g. library. I also would like to exclude files and directories which store downloaded ...
2
votes
2answers
135 views

locate with color

I used locate binary many time to search something on my 1TB HDD. Most of the time, I got many result and I have to read each line to get what exactly I'm looking for. It would be great if the ...
-1
votes
4answers
3k views

Alternative for “locate” on debian

I often use "locate" command on CentOs to find files. What's the alternative for this command on Debian ?
1
vote
2answers
76 views

How to locate a file in a directory

How can I locate a file using locate in CentOS under a specific directory from terminal? Locate search the whole database!
5
votes
4answers
2k views

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 ...
2
votes
4answers
2k views

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 ...
3
votes
1answer
249 views

GTK Frontend for locate

I am a heavy user of the locate tool, which is part of the findutils package. It's fine to use it on command line, but sometimes I would also like to search for a file (as fast as with locate) within ...
4
votes
4answers
251 views

Locating files and displaying their owner

I have to search for a specific file type on a storage unit and also want to know their owners. With locate '*.txt' >> result.txt I find all files I'm looking for but I'm missing the owner this ...
4
votes
1answer
1k views

why updatedb command takes too much time?

I have read that to run locate command on CYGWIN first I need to run the following command. updatedb --localpaths=c:/ what this command exactly do as I run this on CYGWIN and it is taking too much ...
2
votes
2answers
63 views

How to display size of each file next to it after executing the “locate” command?

Is there anyway to display the size of each file next to it after executing the "locate" command?
2
votes
2answers
75 views

Keep only first match from locate output

I need to locate a library on my system and it's name is expected to be found a couple of times. I want to keep only the first occurrence. So far I've tried some methods for splitting strings by ...
2
votes
1answer
175 views

is there a web app for returning results to a search on an indexed database?

I would very much like to allow users in a small office environment harness the power of slocate indexed database on the file server. Currently when users are looking for a file in our fileserver, ...
3
votes
1answer
2k views

'locate' for case-insensitive words?

I wonder how to use the command locate to search for words that are not case sensitive? Such as modify locate normal to search for results that have "Normal" and "normal".
3
votes
3answers
874 views

How to monitor directory/file changes to rebuild index?

Just moved to Ubuntu 12.04 from Windows 7. Under Win 7 I use "Everything" to search files and directories, it can build the index database and update it once any file or directory changes. I'm very ...
4
votes
2answers
713 views

No locate.db even after running updatedb

Any clue what's up with this? djc@miles rebar $ sudo updatedb djc@miles rebar $ locate .dialyzer_plt locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory djc@miles rebar $ ...
1
vote
0answers
397 views

Installing mlocate on mac OS 10.7

I'm a beginner in using Linux. I'm trying to use the command "locate". Once I use this command, I get an error that says the locate database should be created. I used the command below to create that ...
1
vote
2answers
125 views

Why don't find and locate search /bin?

What gives? Normal find and locate commands don't turn up the verify program that lives at /bin/verify. In fact, it seems they don't turn up anything that lives in /bin [jake@jace]/bin% "find" /bin/ ...
3
votes
2answers
6k views

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 ...
0
votes
1answer
248 views

Change where mlocate stores the database?

Looks like it's not configurable through /etc/updatedb.conf, and not mentioned in its manual as well. So can I change that?