techxplore blog
13May

Linux locate: can not open ‘/var/lib/mlocate/mlocate.db’: No such file or directory

Linux operating system has evolved through the years from a mostly command line interface (CLI) to newer graphic user interface (GUI). Most computer geek prefer to use CLI over GUI. They might have a good reason as there are more things that could be done or better run on system command line.

In Linux, a way of finding the location of a file is through the use of an easy to remember “locate” command. Issuing the command followed by a space and the filename returns a list of location where the file could be located. It’s usually required to have root privileged to run the “locate” command. Sometimes though the command returns an error message: locate: can not open ‘/var/lib/mlocate/mlocate.db’: No such file or directory.

fixing locate: can not open '/var/lib/mlocate/mlocate.db': No such file or directory

fixing locate: can not open '/var/lib/mlocate/mlocate.db': No such file or directory

The common reason for this error is that the database which locate command uses to store the list of file locations was not yet updated. It’s important to issue the “updatedb” command without any parameters with root privilege. Failure to run the “updatedb” command before using “locate” command will result the error locate: can not open ‘/var/lib/mlocate/mlocate.db’: No such file or directory.

Leave a Reply