Questions tagged [locate]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
30 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: ...
  • 3
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 ...
1 vote
1 answer
459 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 ...
  • 111
3 votes
1 answer
213 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 ...
1 vote
2 answers
177 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. ...
2 votes
1 answer
50 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 ...
0 votes
0 answers
65 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 ...
  • 95.8k
0 votes
3 answers
4k 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 ...
  • 955
0 votes
0 answers
21 views

Include FUSE mount in updatedb

I want to create a locate database that includes all mounted drives, including a FUSE mount from borg, but I get the following: $ sudo updatedb --debug-pruning -o /var/cache/locate-all.db -l 0 -U $PWD ...
  • 489
0 votes
3 answers
170 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 ...
  • 1
0 votes
1 answer
251 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/...
  • 43
0 votes
1 answer
106 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 ...
  • 417
4 votes
2 answers
717 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 ...
  • 15.2k
0 votes
1 answer
61 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?
  • 193
0 votes
1 answer
315 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 ...
  • 265
0 votes
1 answer
44 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 ...
  • 8,133
-1 votes
1 answer
125 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 ...
0 votes
2 answers
213 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 ...
  • 101
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 ...
  • 23
5 votes
1 answer
559 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 ...
  • 163
3 votes
1 answer
205 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 &...
0 votes
1 answer
32 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 ...
  • 1
1 vote
1 answer
68 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, ...
2 votes
1 answer
137 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 ...
  • 323
0 votes
1 answer
140 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 ...
1 vote
1 answer
373 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 ...
  • 1,510
0 votes
1 answer
164 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/...
0 votes
1 answer
891 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 ...
  • 300
3 votes
2 answers
443 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 ...
  • 1,082
0 votes
1 answer
214 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....
  • 5,756
1 vote
1 answer
249 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 ...
  • 227
2 votes
1 answer
2k 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 ...
0 votes
1 answer
253 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 ...
1 vote
1 answer
3k 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 ...
  • 4,566
3 votes
3 answers
164 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 ...
0 votes
1 answer
648 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?
  • 1,102
1 vote
1 answer
430 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 ...
  • 1,224
1 vote
1 answer
2k 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 ...
3 votes
3 answers
550 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 ...
  • 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 ...
4 votes
2 answers
906 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 ...
0 votes
1 answer
203 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 ...
  • 43
0 votes
1 answer
166 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, ...
  • 306
0 votes
1 answer
73 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
1 answer
262 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 ...
  • 1,192
2 votes
0 answers
610 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 ...
  • 190
0 votes
1 answer
235 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
3 answers
45 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
1 answer
225 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 ...
  • 181
-1 votes
1 answer
621 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@...
  • 12.1k