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?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communitylocate
by default matches entire path so it prints every file in /bin
for example. find / -name
matches only base name of the file (without path) so for /bin
it will print only files with bin in their name. So to make these results closer either use locate --basename
or find / -path
.
sudo locate -b 'bin'
I get 2317 lines while with find I still have 2731, there is still something left, I've noticed that locate doesn't look in /sys do you know why?
locate
also uses indexed database. updatedb
is typically distributed with a standard updatedb.conf
which excludes directories like /tmp
, virtual file systems, ISO mounts, usbfs etc. find
searches all. Directories like /sys
and /proc
are virtual file systems (VFS)
Jun 28, 2021 at 12:38
locate -b bin
print for you? How many lines doessudo find / -path '*bin*'
print? Does yourupdatedb
use a config file like/etc/updatedb.conf
? What is in the file? Please edit the question and add information.