locate Linux Commands
What is Linux locate Command?
Explanation
locate COMMAND:locate command is used to find the location of files and directories in the system. It is used to find the location of list of files in the particular path, which is specified in the command.
SYNTAX :
locate [options] pattern
OPTIONS:
| -u |
Create slocate database starting at path /. |
| -e |
Exclude directories from the slocate database. |
| -f |
Exclude files on specific file systems from the slocate database. |
| -c |
Parse /etc/updatedb.conf when updating the slocate database. |
| -i |
Does a case insensitive search. |
| -q |
Quiet mode. Error messages are suppressed. |
| -n |
Limit the amount of results shown to . |
| -r |
--regexp= Search the database using a basic POSIX regular expression. |
| -o |
--output= Specifies the database to create. |
| -b, --basename |
Find only the base name against the specified patterns. |
EXAMPLE:
-
locate -b 'test'
Output:
/home/uname/Documents/qforquiz/test
/home/uname/opt/dev/lampp/htdocs/xampp/test
/home/uname/opt/dev/lampp/lib/php/test
/home/uname/opt/dev/lampp/lib/php/Math/test
The above command locates and returns the path of files where exactly file name test is stored.