Questions tagged [locate]

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

Filter by
Sorted by
Tagged with
0 votes
3 answers
64 views

Does a command exist that lists all the directories where a word appears in a file or directory name?

When I don't remember where a file or a folder is, I sometime use the locate command (that finds more occurrences, allow more candidates than a find, in my mind. But maybe I'm mistaking). But then ...
Marc Le Bihan's user avatar
0 votes
1 answer
82 views

How to install slocate in Ubuntu

I have seen several references to the slocate command [1][2] as a more secure alternative to the locate command. However I cannot install it using sudo apt install slocate. I also cannot find any ...
Root James's user avatar
0 votes
1 answer
40 views

How could updatedb run quickly by avoiding doing full disk scans (maybe not mtime)

How is it possible for updatedb to run very fast by avoiding doing full disk scans? Since mtime of parent folder is not affected by files in subfolders. In Why does the updatedb program run so fast? @...
srtie's user avatar
  • 3
1 vote
1 answer
77 views

Just as there is "locate" to "find". Is there a database for a faster "grep"?

locate (or rather, updatedb) is somewhat simple: it takes the output of find for the required paths (usually '/'), sorts it, and then compresses it with a front-compression tool (frcode), in which the ...
Sebastian Carlos's user avatar
1 vote
0 answers
40 views

Why locate command doesn't recognize `|` meta character as basic regex?

When i use extended regex on locate command work well: └─$ locate --regex "(\.rar|\.zip)" /home/kali/Downloads/linux.zip /usr/lib/jvm/java-...
testter's user avatar
  • 1,410
1 vote
1 answer
378 views

`plocate` couldn't find results in my home dir but `mlocate` could. How to search results in home dir?

Currently I'm trying to migrate from mlocate to plocate. I'm using mlocate in my script (note: locate is aliased to either mlocate or plocate depending which one I've installed). Successfully searched ...
kohane15's user avatar
  • 154
0 votes
1 answer
199 views

Permission denied with locate command in Shell Script in Oracle Linux?

I am trying to run a shell script that contains the command $locate /etc/*.conf to find all files in /etc/ that end in .conf, but whenever I run the script the command line says /etc/chrony.conf: ...
Luke's user avatar
  • 11
11 votes
3 answers
1k views

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

Output of locate txt | head: /etc/brltty/brl-ba-all.txt /etc/brltty/brl-bd-all.txt /etc/brltty/brl-bl-18.txt /etc/brltty/brl-bl-40_m20_m40.txt /etc/brltty/brl-ec-all.txt /etc/brltty/brl-ec-spanish.txt ...
Random Person's user avatar
6 votes
1 answer
4k views

Difference between mlocate and plocate

Since locate doesn't work by default in Ubuntu 22.04.1 LTS, and the message on the terminal says: Command 'locate' not found, but can be installed with: sudo apt install plocate As we can see, it ...
user12002570's user avatar
3 votes
1 answer
513 views

locate and updatedb do nothing in Linux Mint

I run Linux Mint 21. Currently the locate command always returns no results, and updatedb always returns immediately. The database is sized no more than a few kilobytes. I have verified that the ...
brainchild's user avatar
1 vote
2 answers
776 views

How can I/Should I default flags when running a command?

For context, I'm using zsh. Every time I use locate, I want to pass the -i and -A flags. Usually, if I can get away with it, I create an alias with the same name as the existing command to do this. ...
Daniel Kaplan's user avatar
2 votes
1 answer
103 views

Can updatedb keep localpaths for removable drives that aren't plugged in?

I run updatedb like this: updatedb --localpaths="/a /b" /a is a removable drive. /b is the local hard drive. Although /a's not always accessible to me, I frequently want to run locate to ...
Daniel Kaplan's user avatar
0 votes
0 answers
102 views

Does the database created by updatedb expire after a certain amount of time?

A few days ago, when I ran locate to find some files in my home filesystem, it didn't return anything. It seemed to me that it had only indexed the files in the root filesystem but not the home ...
Tim's user avatar
  • 102k
0 votes
3 answers
13k views

plocate updatedb /var/lib/plocate/: Is a directory error

plocate is a locate(1) based on posting lists, giving much faster searches on a much smaller index. It is a drop-in replacement for mlocate in nearly all aspects, and is fast on SSDs and non-SSDs ...
xpt's user avatar
  • 1,560
0 votes
3 answers
266 views

alternative to find for search and copy files?

I have many files called themes.txt (but different in content) scattered in various folders. I would like to use the locate command (not find !!!) to search for them and the cp -backup command to copy ...
bisius's user avatar
  • 1
0 votes
1 answer
514 views

updatedb does not prune paths

I have a timeshift user with backups in my /home. Every time after boot when I search for something with locate, all the timeshift directories are shown to me. To fix this issue, I added /home/...
hmaier's user avatar
  • 53
0 votes
1 answer
209 views

macOS / BSD - add dir to locate database?

How do I add a directory to be indexed by locate.updatedb on macOS / BSD so that I can find files in that directory with the locate command? I read the man page of locate(1) on Mac, but didn't find ...
Teddy C's user avatar
  • 457
4 votes
2 answers
944 views

Find XML file with specific path

I'm working with XML files, each of which could be dozens of lines long. There are literally hundreds of these files, all over a directory structure. Yes, it is Magento. I need to find the file that ...
dotancohen's user avatar
  • 15.9k
0 votes
1 answer
89 views

Why locate gives more lines output than find

For example I will look for everything which contains 'bin' in its name locate 'bin' gives me 7732 lines of output sudo find / -name '*bin*' gives me 2730 lines of output why?
pjk's user avatar
  • 323
0 votes
1 answer
560 views

For loop and locate command with regular expression mismatched

when I change any configuration I made a copy of the original file with suffix .original. Now I am composing a simple script that will find all *.original files and work with both versions, ie with ...
ino's user avatar
  • 317
0 votes
1 answer
88 views

Can I use locate's functionality to find symlinks faster?

I've just read: How to find all symbolic links pointing to any file/directory inside a given directory but that is pretty slow. Now, on typical Linux systems, a filesystem database-of-sorts is ...
einpoklum's user avatar
  • 9,525
-1 votes
1 answer
200 views

Can GNU FindUtils be configured to skip a directory?

When I run updatedb I get an error "Permission denied" to /run/user $ sudo updatedb /usr/bin/find: '/run/user/1000/doc': Permission denied Note my version of updatedb comes from the package ...
Evan Carroll's user avatar
  • 30.9k
1 vote
2 answers
486 views

`locate` in linux vs osx

I often use locate as a command to find stuff system-wide. However, I find it very annoying that the osx version of locate doesn't seem to have the -b option to match the basename only; and so prints ...
Martino's user avatar
  • 111
2 votes
4 answers
2k views

ifconfig and locate command not found, `bash: ifconfig: command not found`

In the Linux-Ubuntu terminal: ifconfig throws bash: ifconfig: command not found locate command does the same. sudo yum install net-tools throws: bash: yum: command not found as well, but I might also ...
pelz's user avatar
  • 23
5 votes
1 answer
677 views

Understanding locate command regex

To use locate command with regex , do we need to enclose the pattern in quotes along with passing --regex option ? If yes, then what do the following mean - a) locate --regex file* ? Here regex will ...
Number945's user avatar
  • 163
3 votes
1 answer
236 views

"locate" returns relative instead of absolute paths

One advised me to post here since this would be more appropriate (I am going to remove the previous one). On my MacBook, I have the following entry in root's crontab: 0 */4 * * * cd /private/var/root &...
youpilat13's user avatar
0 votes
1 answer
35 views

How can I see the main package for a given program in Centos 8

I want to know which exact installed package that allows a program to run, I used locate <program_name> command, but that seems to throw all related files a directories that contains that ...
otto_'s user avatar
  • 1
1 vote
1 answer
100 views

locate: regex repetition postfix operator doesn't work with --regextype emacs

I have some files whose the names are of the form krita-NN.kra where NN is a number having one to two digits. I wanted to locate them using Emacs regex. However, the repetition postfix operator (\{n, ...
Firmin Martin's user avatar
2 votes
1 answer
169 views

mlocate: how to print files only [duplicate]

I have the following version of locate: $ locate --version mlocate 0.26 Copyright (C) 2007 Red Hat, Inc. All rights reserved. This software is distributed under the GPL v.2. This program is provided ...
s.ouchene's user avatar
  • 321
0 votes
1 answer
176 views

Rsync running every month can't stop it

I have never used rsync for backup before. I'm not a advanced user by any means, but enjoying Linux. I was following instructions, from a website (have now lost the url) and I managed to set up rsync ...
Windwalker's user avatar
1 vote
1 answer
501 views

Updatedb include the path pointed by symbolic link

I have created mlocate database with the contents of a particular folder. I see that the updatebd doesn't include the path pointed by the symbolic links in the database. How can I include the path ...
Porcupine's user avatar
  • 1,902
0 votes
1 answer
275 views

apt-file can not find a dkms file

Before I upgrade to Debian Bullseye, apt-file was pretty logical. Now I can't get it to work. What am I doing wrong? Did the behavior change? # apt-file update Hit:1 http://repo.steampowered.com/...
Evan Carroll's user avatar
  • 30.9k
0 votes
1 answer
1k views

sed command does not work with find -exec?

I have this file: file.txt: ... threshold: swipe: 2 pinch: 2 interval: swipe: 2 pinch: 2 No, if I do : $ locate config.yml | while read i; do sed '/swipe|pinch/s/[0-9]/3/' $i; done it ...
Herdsman's user avatar
  • 340
3 votes
2 answers
594 views

Which parts of a Linux system does locate index or not index? [duplicate]

I had a look at man locate but couldn't find an answer to this. The updatedb command appears to index everything under /, but according to my experiment it didn't index a file at /media/mike/W10 D ...
mike rodent's user avatar
  • 1,132
0 votes
1 answer
250 views

find does not work, locate does

So I have this bit: systemctl list-unit-files | grep --ignore-case networkmanager | grep --ignore-case service | cut --fields=1 --delimiter=" " Which gives as output: NetworkManager-dispatcher....
Fabby's user avatar
  • 5,384
1 vote
1 answer
319 views

Different mlocate database for each user?

This may come across as a silly question because each file and directory on a system can and will have permissions to block an ordinary user from seeing various files- but for added security sake and ...
Tmanok's user avatar
  • 227
2 votes
1 answer
3k views

How can I change the configuration of /etc/updatedb.conf file?

Based on the man page of the command "updatedb", we can change and override the configuration of /etc/updatedb.conf using the below commands: --prune-bind-mounts FLAG Set ...
Aref Alikhani's user avatar
0 votes
1 answer
481 views

How can I limit locate command to search current directory?

Locate search is not limitable to current directory: I am trying to learn so I decided to write this script cd /usr/share/doc && ls -R | grep "\.html" | sudo tee htmldoclist.txt Then I want ...
noob_sabidiot's user avatar
2 votes
1 answer
4k views

Sudo updatedb `/var/lib/mlocate/mlocate.db' is locked due to faulty drive, how to resolve permanently?

This 4.20.3 Arch system its BTRFS formatted / disk is without free space left. It turns out that mlocate is the cause: # du -h --exclude=Volumes -- * 2>/dev/null | sort -hr | head -2 11G var 9.6G ...
Pro Backup's user avatar
  • 4,924
3 votes
3 answers
171 views

Search for arbitrary files but only list matches in results once

I want to search for arbitrary file/directory names, but only want to list file paths containing the search string at the same position once. Especially not every file within a directory matching the ...
Simon Schürg's user avatar
2 votes
1 answer
902 views

How to list all files in mlocate database file?

when updatedb is run it generates a mlocate.db file. How to list all the files in the mlocate.db file? locate * is this correct?
Akhil's user avatar
  • 1,290
1 vote
1 answer
482 views

Synapse launcher: what is the difference between the `locate` command and the simple search?

I love Synapse in Xfce and want to know more about improving its use. I use it to restart, logout or shutdown, launch applications, access files and folders. I have been trying to fix a few ...
cipricus's user avatar
  • 1,549
1 vote
1 answer
3k views

Locate doesn't work

System: Linux Mint 19.1 Tessa, edition: Cinnamon Got a problem with a locate command. I created test.txt file on a desktop. After that I did: sudo updatedb However locate test.txt -i still ...
Ghostery's user avatar
3 votes
3 answers
705 views

Locate but exclude names - Linux

I am trying to locate all the files named hosts on a linux PC remotely. The problem is there are almost several thousand files with ghostscript as one of the upper directory names or as part of a ...
BigRedEO's user avatar
  • 141
3 votes
1 answer
1k views

Delete the "locate" database in FreeBSD

After having established the locate command's database indexing file & directory names across my FreeBSD 12 system (as described in this related Question), I now regret doing so because of its ...
Basil Bourque's user avatar
4 votes
2 answers
1k views

Safe secure way to locate a file in FreeBSD?

In FreeBSD 12, on a freshly-created virtual machine (DigitalOcean), I tried to use the locate command. $ locate java I received an error. locate: database too small: /var/db/locate.database ...
Basil Bourque's user avatar
0 votes
1 answer
276 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 ...
macdays's user avatar
  • 53
1 vote
1 answer
200 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, ...
aksh1618's user avatar
  • 326
0 votes
1 answer
115 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 ...
Born vs. Me's user avatar
1 vote
1 answer
425 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 ...
voices's user avatar
  • 1,272