We have Centos 7.
Trying to use the 'locate' command yields nothing, even if the searched file[s] actually exist.
No error is printed.
Also executed 'sudo updatedb' to update the 'locate' indexes.
Any ideas?
Thank you
If the locate command is not already installed on your system, you will encounter an error such as locate command not found or bash: /usr/bin/locate: No such file or directory when trying to execute the command. The simple solution to this problem is to install locate with your system's package manager.
The locate command finds files in Linux using the file name. locate is used for obtaining instantaneous results, and it is an essential utility when speed is a priority. The command performs the search using a database containing bits of files with the corresponding paths in the system.
The syntax for the locate command is as follows: locate [OPTION] PATTERN... In its most basic form, when used without any options, the locate command will print the absolute path of all files and directories that matches the search pattern and for which the user has read permission. The /root/.
Installing locate (locate command not found) Depending on the distribution and how the system was provisioned, the locate package may or may not be pre-installed on your Linux system. To check whether the locate utility is installed, open up your terminal, type locate and press Enter.
The locate command searches the file system for files and directories whose name matches a given pattern. The command syntax is easy to remember, and results are shown almost instantly. For more information about all available options of the locate command type man locate in your terminal.
On most CentOS/RHEL systems, findutils comes pre-installed, however, if you try to run a locate command, you may encounter the error: In this article, we will show you how to install mlocate package which provides the locate and updatedb commands to find files in Linux systems.
If locate is not installed, you can easily install it using the package manager of your distro. The locate command searches for a given pattern through a database file that is generated by the updatedb command.
To install the locate package, use yum:
$ yum install mlocate
To update it’s "internal database", run following command.
$ updatedb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With