I have a 16.04 installation set up with my Downloads folder pointing to a secondary hard drive (shows Downloads -> /mnt/data/Downloads ). When I run locate to search for files, it doesn't show any files on this drive. I've run a sudo updatedb and I check my updatedb.conf (nothing I see excluded the /mnt directory or the files I'm looking for)

The interesting thing to me is when I cd /mnt/data/Downloads then run locate I can see everything in this directory but not on my primary drive. It's almost like Ubuntu has two different locate databases depending on which drive I'm on.

How can I remedy this situation?

Additional: Here's my updatedb.conf

# PRUNENAMES=".git .bzr .hg .svn"
PRUNEPATHS="/tmp /var/spool /media /home/.ecryptfs /var/lib/schroot"
PRUNEFS="NFS nfs nfs4 rpc_pipefs afs binfmt_misc proc smbfs autofs iso9660 ncpfs coda devpts ftpfs devfs mfs shfs sysfs cifs lustre tmpfs usbfs udf fuse.glusterfs fuse.sshfs curlftpfs ecryptfs fusesmb devtmpfs"

I tried running sudo locate and that didn't change the results. I tried running mlocate and sudo mlocate and that didn't change the results either.

I also tried finding another updatedb.conf file and came up empty.

Update 1: The file system on the secondary drive is ext4.

Update 2: Nothing's encrypted either. I've been Googling around and noticed that's been an issue for some users.

Update 3: I'm more confused now. I'm trying to find all of the .iso files on my machine, below are the results:

@:~$ locate FreeNAS


@:~$ locate *.iso


@:~$ locate iso



(and a bunch of other results)

@:~$ find . -type f -name "*.iso"


Update 4: More results: sudo find / -type f -name "*.iso" gives me the results I want but takes a long time to come back with those results.

I wanted to dig in and see if I indeed did have two different databases since I get different locate results based on which drive I'm in. After checking the MAN page I searched for an mlocate.db file on my system, here's my results:

  • /usr/share/man/man5/mlocate.db.5.gz
  • /var/lib/mlocate/mlocate.db
  • /var/lib/mlocate/mlocate.db.VEzhqO

I was thinking possible the .VEzhqO file might be a secondary database so I tried specifying that with the -d flag for the locate command. That gave me "can not stat" error. The mystery continues.

Update 5: I have reproduced this on another Ubuntu machine, 16.04 server edition.

Update 6: So I have a solution, locate "*.iso" but now I'm curious "why" that works. I looked at the MAN page and these two links: http://www.linfo.org/locate.html and http://www.howtogeek.com/112674/how-to-find-files-and-folders-in-linux-using-the-command-line/ . None of these shed any light on why that works.

  • 1
    Could you please edit your question and include the content of /etc/updatedb.conf? Also, what file system does the secondary drive have?
    – Byte Commander
    Sep 7, 2016 at 14:52

3 Answers 3


In all shells, using *.iso expands to a list of files before calling the command, so in

locate *.iso

the shell expands automatically the expression creating a filename list from files in the current directory. Suppose there where in the current directory two iso files file1.iso and file2.iso; the resulting command will actually be:

locate file1.iso file2.iso

then the shell will execute it. So, locate will try to find files containing these two strings, effectively searching for "*file1.iso*" or "*file2.iso*".

That's why locate iso find more files than locate *.iso; locate is actually searching for "*iso*" in the first case. The solution (and right way to use it, IMHO) is quoting the special chars of the shell when the command accepts expressions using them, like the following find command:

find /etc/ -type f -iname "*.conf"

If there where two or more conf files in the current directory and we don't use quotes, the find command will fail parsing the second filename generated, and our hair density will be severely reduced in desperation and googling ;D because the error message seems not related to the absence of quotes.


For some reason,

locate *.iso 

only searches your current directory for .iso files while

locate "*.iso" 

searches all of your drives. This is the solution to my problem though.


Locate automatically applies * before and after the string so the easiest solution is:

locate .iso

I also have two Windows drives mounted. when running locate from Ubuntu partition I get similar results as your question. Using this answer the correct results are obtained:

rick@alien:~/Downloads/cfiles$ locate "*.iso" | wc -l
rick@alien:~/Downloads/cfiles$ locate *.iso | wc -l
rick@alien:~/Downloads/cfiles$ locate .iso | wc -l

You must log in to answer this question.

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