Questions tagged [locate]
`locate` is a command-line tool for local file search using a database.
132
questions
0
votes
0
answers
7
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 ...
0
votes
3
answers
74
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 ...
0
votes
1
answer
67
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/...
0
votes
1
answer
42
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 ...
4
votes
2
answers
479
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 ...
0
votes
1
answer
56
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?
0
votes
1
answer
133
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 ...
0
votes
1
answer
23
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 ...
-1
votes
1
answer
63
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
121
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 ...
0
votes
3
answers
1k
views
ifconfig and locate command not found
I am new in linux-ubuntu and I see ifconfig the not found in terminal and I writed sudo yum install new-tool but came yum the not found error . What means that ,must I install ifconfig ? or are there ...
5
votes
1
answer
430
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 ...
3
votes
1
answer
187
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
vote
1
answer
36
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
78
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 ...
0
votes
1
answer
91
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
218
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 ...
0
votes
1
answer
88
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
375
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 ...
2
votes
2
answers
306
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 ...
0
votes
1
answer
169
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....
1
vote
1
answer
184
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 ...
2
votes
1
answer
1k
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
108
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
2k
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 ...
3
votes
3
answers
160
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
334
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
vote
1
answer
375
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
vote
1
answer
1k
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 ...
2
votes
3
answers
361
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 ...
3
votes
1
answer
869
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
707
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
151
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
1
answer
135
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
1
answer
44
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
144
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
0
answers
515
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
1
answer
155
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
43
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
161
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 ...
-1
votes
1
answer
576
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
2
answers
593
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
3
answers
228
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
1
answer
70
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
4
answers
777
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 ...
1
vote
1
answer
169
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
1
answer
252
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
3
answers
766
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
1
answer
6k
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: ...