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


locate test.txt -i 

still doesn't show anything.

Permissions to mlocate.db: -rw-r---- Working on normal user, not root (that's why I was using sudo command)

  • It is better to fix permissions that to use sudo (not an answer). Aug 6, 2019 at 10:28

1 Answer 1


The updatedb command will scan the filesystems on your system and create an index of the names of the available files and directories. This indexing is performed as a non-privileged user. This means that the index will only ever contain the names of files that are accessible by all the system's users.

Since your home directory is only accessible to yourself (you say in comments that you have rwx------ permissions on it), this means that it will not be indexed by updatedb. This in turn means that locate will never return names from within your home directory (using sudo locate instead of just locate will still query the same index, so that won't help).

To solve this, you have two options:

  1. Loosen up the restrictions to your home directory (and to any directory beneath that that you want to be indexed by updatedb). The permissions should probably read rwxr-xr-x, or 755 in octal.

  2. Don't use locate to find files. Instead use find:

    find "$HOME" -name test.txt

    This would look for anything called test.txt in or under your home directory.


You must log in to answer this question.

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