Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [locate]

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

0
votes
0answers
14 views

find -name vs locate [duplicate]

Why this command: locate $FILENAME is NOT the same of find / -name $FILENAME 2>/dev/null ? Sometimes locate finds nothing, while find never fails.
0
votes
1answer
34 views

updatedb is generating an incomplete list of files

I'm running the following command: updatedb -l 0 -o mydatabase.db -U /usr/myfiles1/ Then, locate -d mydatabase.db "" The "" are to show all the contents of mydatabase.db. However, I'm missing ...
0
votes
0answers
15 views

updatedb command [duplicate]

I have two directories DirA and DirB, when I am running sudo updatedb -U DirA then only files under DirA are visible to locate command but I want files under "DirB" be visible. So in my case is DirA ...
0
votes
0answers
35 views

Truncate from beginning in Rofi

I'm using this command for a rofi-locate script (source): xdg-open "$(locate $query | rofi -threads 0 -width 90 -dmenu -i -p "locate:")" Currently all long path results are truncated from the end, ...
0
votes
1answer
20 views

linux file tree database file

When i install mlocate i must run updatedb I was wondering if there is a db file with all the files on the system and their paths is there a msterfile that contains all the file location/names on ...
1
vote
1answer
35 views

Locating font files

There's a utility called fc-list in the fontconfig library, that's good for listing installed fonts. It detected a few hundred system fonts. I ended up using find to locate all files with common ...
2
votes
0answers
105 views

locate: using updatedb to create a database of directories only?

GNU findutils' man page for updatedb says it has a --findoptions parameter. Does it mean I can specify a find-like option there to create a specific database for locate? Like this, to include ...
0
votes
1answer
45 views

How can I find exactly which files have been accessed after a command runs in tcsh?

how can I find which files tcsh reads to TAB complete the second word of a command, as opposed to the first word. I know I can just use whereis complete to see the path to *.1.gz file, but that is ...
0
votes
3answers
37 views

locate stop repeating when a directory contains a name

Sometimes when using locate, my search string will (either incidentally or intentionally) match a portion of a directory. This causes everything below that point in the directory to be printed. For ...
0
votes
1answer
45 views

The locate command finds files that aren't there

I use a Mac running High Sierra. I am cleaning up my hard drive and I was looking for remnants of a program I deleted from my Mac. I used the locate command like this: locate Canopy. I once had the ...
0
votes
0answers
24 views

do `locate` use an array to store information? [duplicate]

Since i know that locate command use "index" to locate a record, is it possible that the implement of the search method is based "array"?
-1
votes
1answer
255 views

Command which do not locate the real path of command

We have a RHEL 7.x with Hortonworks (HDP) installed and need an advice why we get on which command: no hadoop in ... The Hadoop client is installed under /usr/bin and from env we get [root@...
1
vote
2answers
152 views

How to use locate with a world-unreadable home directory

man locate says: The locate database is typically built by user ``nobody'' and the locate.updatedb(8) utility skips directories which are not readable for user ``nobody'', group ``nobody'', or ...
0
votes
3answers
58 views

Solution to change directory passing a directory pattern as the parameter

I'd like to get any script or Linux solution to implement changing directory passing not exactly a directory but a pattern as the parameter. Something like this: # Ex: I'd like to execute a "cd" to a ...
0
votes
1answer
57 views

How to know where the last file created by my current user is located?

I use Ubuntu 16.04 (xenial) with Bash 4.3.48(1) and zip 3.0. In a file containing a bash script (#!/bin/bash) with many different functions, I also have this function used to create a full database ...
0
votes
4answers
183 views

Count number of files that are not symbolic links in output from “locate”

I'm trying to count the number of non-symbolic linked files passed by the locate command. I've tried a number of options and think this is the most promising: locate -r "$PWD.*\.c$" | xargs -0 -I{} ...
1
vote
1answer
35 views

How to pass multiple DB files to locate?

I want to pass multiple DB files to the locate command, like this: locate -d ~/.a_locate.db:~/.b_locate.db: -Ai file_to_find But this gives me this error: locate: can not stat () `~/.b_locate.db': ...
0
votes
1answer
133 views

Using regex for locate and grep to get only folders

When I try to search using locate and grep something like: locate A-B | grep .dir The result is: .../A-B-C.dir .../A-B-C.dir/file .../A-B-C.dir/file1 .../A-B-D.dir .../A-B-D.dir/file1 ... How to ...
1
vote
3answers
309 views

changing the default database for locate and mlocate

I managed to run locate and mlocate so that it uses an encrypted partition, i.e. my home folder. See this post. However, how do I make the new, relocated mlocate.db database the default? I now ...
-1
votes
1answer
3k views

Debian unable to locate packages php [closed]

I just started to explore debian for the first time, and wondered if anyone knew anything about the "unable to locate packages" I get this error when I am trying to run ./installer.sh (a file) E: ...
0
votes
0answers
401 views

Is there a way to use find to filter a file list?

I have the output of locate --existing --regex that was quite fast to obtain. A similar find takes several hours - it's a huge volume. I would like to apply further find filters to this file list. ...
1
vote
3answers
64 views

Simple CLI tool for searching

Is there a CLI tool similar to gnome-search-tool? I'm using locate, but I'd prefer that it grouped results where directory name is matched. I get a lot of results where the path is matched which is ...
0
votes
1answer
245 views

How do I compare mlocate.db to what exists now?

I ran rm -rf on /var/cache/lxc, not realizing it was full of symlinks. I've lost a bunch of files, including most of /dev. I have a mlocate.db from 16 hours ago. How do I compare the list of files ...
1
vote
1answer
83 views

Improve search for files by pathnames with locate and grep pipeline

I often use the following pipeline of locate (from findutils) and grep to find files whose pathnames contain two words word1 and word2, without any specific order between each other: locate -i word1 |...
1
vote
0answers
21 views

BSD/macOS updatedb spec?

For linux, the format of mlocate's DB is documented here. Without diving into the source, is there a similar spec for BSD / macOS locate.database available?
1
vote
1answer
23 views

Do some file get excluded from being saved in the locate database?

Does the locate database not save certain files? Like are there files that excluded from the database by default?
-1
votes
2answers
515 views

What situation is `find` and `locate` best used in? [closed]

I know that locate has to have a database generated and is much faster, and that find does not need a database generated and is not as fast. So in what situations is find and locate more efficient/...
0
votes
1answer
997 views

Cannot locate zlib or pcre location after install

I installed zlib1g zlib1g-dev libpcre3 libpcre3-dev with apt for NGINX open source over installing zlib & pcre in their own folders. I cannot seem to locate both zlib & pcre libraries on my ...
2
votes
1answer
85 views

When counting source files and LOC with locate and find - why do Python files come up different?

I am having trouble understanding why find and locate would work differently for C and Python source files. My goal is to count the number source files and the sum of their source code lines for a ...
4
votes
1answer
565 views

How to rename filenames with accents on macOS?

I am trying to rename files that include the character "à". I do the following : rename -v 's/à/a/g' * But it shows all the files as unchanged. Verbose mode shows the same thing. I tried to escape ...
25
votes
3answers
5k views

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

How do i delete everything of specified “name”

A few days ago I installed pcsxr and today I wanted to completely remove everything of pcsxr I tried to purge it but when I execute locate -c pscxr the output was 48 so it means I still have a ...
2
votes
3answers
72 views

how to find occurrences of a file using locate

There are multiple installation of Java on my system, some silently installed by IDEs, and I wanted to find out where they are. So I thought to use locate to find them. My first try of locate java ...
2
votes
1answer
58 views

How to redirect a list of human readable paths to another command?

When working with the output of commands such as locate which produce lists of paths in "human readable form" (i.e. without \ in front of spaces), how do you redirect their output to another command? ...
2
votes
1answer
469 views

How indexing works with locate command?

locate command searches an index that the system builds periodically. How to make sure, any new file you're looking is part of index? Is there any explicit command to index?
2
votes
5answers
305 views

Quick way to open results from `find` or `locate`

When I run find or locate, the matching files will populate stdout, one file per line. The next step is often that I want to open one of these files. This would be faster and more efficient if I did ...
1
vote
3answers
87 views

How can I choose one of `locate`'s results and let it be opened with a specified application

I have a bash script called findme, which is coded as follows: #!/bin/bash locate -Abi '*\.'$1 $2 | grep --color=always -ni $2 | less -R It searches for me for all files with a specified file ...
1
vote
1answer
31 views

locate is not locating the file present in the current directory

That media is another hard disk in the computer. What is the way to locate things there?
1
vote
2answers
117 views

locate(1) buffers its output [duplicate]

I'm using locate(1) from GNU findutils for a little task and it seems as if it buffers its output. I am piping the output of locate to another task that will process the lines as locate finds them. ...
1
vote
1answer
197 views

locate outputs question marks when locatedb contains certain characters (tabs) unless output is piped

I construct my own locatedb using frcode so it would contain filesizes after paths (it helps me look for large files quickly). I store the path separated from the size by a tab character. I've noticed ...
0
votes
2answers
6k views

Where is the current wallpaper stored in Kali Linux?

I have a script that sets one exact image as a wallpaper and I want it to check at every run if it's still the same image. If not, it asks you if you want to change wallpaper again to this image. It's ...
6
votes
4answers
3k views

How to locate a path?

Is it possible to locate a path in the file system like what can be done for file names? For example I want to find all paths in system that include 'foo/bar', which may have the following result: /...
0
votes
1answer
49 views

How to locate exactly that executable, which will be run if it's name entered in command line? [duplicate]

Is it possible to locate exactly that executable myname which will be run if passed to command line > myname locate command didn't work as expected, since it returns numerous results. Result ...
1
vote
2answers
91 views

Search tool with file content indices

Are there any file search tools like gnome-search-tool (gui where I can select several options, like age of file, file-size, owner, etc) that uses DB indices for not only the file name but the file ...
0
votes
2answers
209 views

Why can't 'locate' or 'find' find 'makeinfo'? [closed]

When I do: locate makeinfo OR find / -name "*makeinfo*" I get nothing. But when I do makeinfo --help, it gives me the proper help output. How is this possible? If makeinfo is an executable, it ...
1
vote
2answers
82 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 /var/lib/mysql/db/...
11
votes
2answers
11k 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 ...
0
votes
4answers
579 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 ...
0
votes
1answer
57 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 ...
3
votes
2answers
521 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 ...