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


  • How many lines does locate -b bin print for you? How many lines does sudo find / -path '*bin*' print? Does your updatedb use a config file like /etc/updatedb.conf? What is in the file? Please edit the question and add information. Commented Jun 28, 2021 at 10:31
  • 1
    Finding just one line that is in both files, and another line that is only in the larger file, would probably give a serious hint as to what is going on. Commented Jun 28, 2021 at 10:47

1 Answer 1


locate 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.

  • now when I do 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?
    – pjk
    Commented Jun 28, 2021 at 11:31
  • 1
    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)
    – ibuprofen
    Commented Jun 28, 2021 at 12:38
  • thnak you, now I understand
    – pjk
    Commented Jun 28, 2021 at 14:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .